Page 1 of 1
real mode programming
Posted: Mon Sep 03, 2007 8:46 am
by ezome
does anyone know a good reference about register behavior/usage in real mode
i wrote a bootloader and it seems to work fine but my c kernel acts a little bit strange and i dont know if maybe i messed it up from real mode
Posted: Mon Sep 03, 2007 8:57 am
by JamesM
AFAIK register behaviour shouldn't change from real->protected mode, as register's are static and dont have any set 'behaviour'... ?
Not quite sure what you're asking
Posted: Mon Sep 03, 2007 9:10 am
by ezome
i'm just not sure how the different registers are used and how i could mess up my memory without noticing
the only register i ever initialize is sp and i'm not even sure how registers are changed by a call
so all i would need is a detailed reference how commands effect registers and so on
Posted: Mon Sep 03, 2007 9:12 am
by neon
I *think* he's referring to memory addressing with the segment registers, which does change between real/pmode's.
If so, then its just the standard seg:offset model under real mode... As long as you stay real mode, they cannot change behavior.
I suspect there is probably a different problem with your code.
Posted: Mon Sep 03, 2007 9:14 am
by AJ
Hi,
Although there can be an art to choosing the correct register for the correct thing, if you are programming in real mode in assembly, you can pretty much do what you like.
Have a look at this reference:
http://www.swansontec.com/sregisters.html which I found quite interesting reading.
Cheers,
Adam
Posted: Mon Sep 03, 2007 11:27 am
by ezome
neon wrote:I *think* he's referring to memory addressing with the segment registers, which does change between real/pmode's.
If so, then its just the standard seg:offset model under real mode... As long as you stay real mode, they cannot change behavior.
I suspect there is probably a different problem with your code.
i'm not referring to something specific
i wrote about 5 pages of assembly code for my bootloader and want to get a better understanding just to be sure i did it correctly.
i mean it's working but that doesn't mean there are no errors right?
Posted: Mon Sep 03, 2007 1:57 pm
by ezome
thanks adam
great article
do u know a good x86 reference which explains
the purpose and how to use each command properly
i'm sometimes quite lost when i dont know which command
i need or how to use it and what it does exactly
Posted: Mon Sep 03, 2007 2:14 pm
by Zenith
The
Intel Manuals are your friends...
If you're trying to be backwards compatible (like programming in realmode...), use this
older manual for the 80386.