ok, i got my 'real mode' kernel starting in mode 13h.. now i have a command that changes video modes, but it doesn't...
at the top of my kernel, i have:
[tt]mov ax, 13h
int 0x10[/tt]
and in my video command i have:
[tt]mov ax, strCmd1
int 0x10[/tt]
now strCmd1 is the attrib to the video command, so when in the console in bochs, i type video 00h and nothing changes, the video doesn't change... any help here?
Video modes in asm
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Video modes in asm
err ... what kind of digital lifeform is strCmd is ?
i mean, if you do "mov ax, strCmd", you just put the address of a memory region in ax. You don't expect the processor to understand that he should read the ascii bytes "00h" (in other words, if the string is C-like encode, the array of bytes 30h,30h, 69h,00h) located there and replace ax with the value 0, do you ?
And if you already made the conversion between the string and the integer and stored the integer value in strCmd (in which case i would strongly recommend you to rename your variable), you'd have to use "mov ax, [ strCmd ]" to pick the value (if you're using nasm), and not "mov ax, strCmd" which loads the address...
Remember your computer is *not* a wiZard ... if what you try to do seems magic, it means your computer can't do it
i mean, if you do "mov ax, strCmd", you just put the address of a memory region in ax. You don't expect the processor to understand that he should read the ascii bytes "00h" (in other words, if the string is C-like encode, the array of bytes 30h,30h, 69h,00h) located there and replace ax with the value 0, do you ?
And if you already made the conversion between the string and the integer and stored the integer value in strCmd (in which case i would strongly recommend you to rename your variable), you'd have to use "mov ax, [ strCmd ]" to pick the value (if you're using nasm), and not "mov ax, strCmd" which loads the address...
Remember your computer is *not* a wiZard ... if what you try to do seems magic, it means your computer can't do it
Re:Video modes in asm
ahh, i am no good at asm.. so i didn't know.. i will try to stick with c or c++ as much as possible, there i don't have to worry as much as asm ;D
is there a list of memory locations for video or keyboard, that i can access in c.. specially keyboard?? can you get the key typed in c without using asm?? again, i am real new..
is there a list of memory locations for video or keyboard, that i can access in c.. specially keyboard?? can you get the key typed in c without using asm?? again, i am real new..
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Video modes in asm
well, if you plan to stay in real mode for a while, you could try to use the BIOS keyboard buffer directly, but the best thing to do is probably to write a small ASM function that will call the BIOS keyboard read and return the argument to C (hint: C expect values to be returned through AX register )
however, i think you should spend a few time to really figure how the computer works (beyond the C/C++ language) -- like what pointers really are, etc.
I think one can really understand how a computer works if (s)he know and fully understand a bit of assembly (especially the use of stacks and registers, memory adressing, etc.)
however, i think you should spend a few time to really figure how the computer works (beyond the C/C++ language) -- like what pointers really are, etc.
I think one can really understand how a computer works if (s)he know and fully understand a bit of assembly (especially the use of stacks and registers, memory adressing, etc.)