real mode programming

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
ezome
Posts: 20
Joined: Thu Aug 30, 2007 3:09 pm
Location: Germany

real mode programming

Post 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
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Post 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 :P
User avatar
ezome
Posts: 20
Joined: Thu Aug 30, 2007 3:09 pm
Location: Germany

Post 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
User avatar
neon
Member
Member
Posts: 1567
Joined: Sun Feb 18, 2007 7:28 pm
Contact:

Post 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.
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Post 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
User avatar
ezome
Posts: 20
Joined: Thu Aug 30, 2007 3:09 pm
Location: Germany

Post 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?
User avatar
ezome
Posts: 20
Joined: Thu Aug 30, 2007 3:09 pm
Location: Germany

Post by ezome »

AJ wrote: Have a look at this reference: http://www.swansontec.com/sregisters.html which I found quite interesting reading.
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
User avatar
Zenith
Member
Member
Posts: 224
Joined: Tue Apr 10, 2007 4:42 pm

Post by Zenith »

The Intel Manuals are your friends...:D

If you're trying to be backwards compatible (like programming in realmode...), use this older manual for the 80386.
"Sufficiently advanced stupidity is indistinguishable from malice."
Post Reply