Page 1 of 1
How are addresses calculated in 32bit real mode?
Posted: Fri Jun 22, 2012 2:44 pm
by Mahkoe
I've been learning how addresses work, and any information I found (as far as I understand it) talks about two 16 bit registers used as a segment and an offset. It makes sense, but while I was reading an explanation of movsb (since I didn't know what it was when I was signing up) it mentioned that it can use the extended registers. How are addresses calculated with these 32bit registers? And if the 64 bit registers are sometimes used, how are they used?
Thanks
Re: How are addresses calculated in 32bit real mode?
Posted: Fri Jun 22, 2012 5:40 pm
by Kazinsal
32-bit real mode is a bit of a kludge of names there. Real mode is inherently 16-bit. However, you can put the processor into protected mode, load your data segments with a 4GB limit, then drop back to real mode. Reload your data segments, and while the base will change, the limit will no longer be 64KB but stay as 4GB. This is known as unreal mode, and I'm going to assume that's what you're talking about.
When in "unreal mode", you can address data via the 32-bit registers. The segment will be shifted four bits to the left and added to the offset as usual, but the offset is now 32 bits wide instead of sixteen, allowing you full access to the 4GB physical address space. So 0x1234:0x56789ABC will be calculated as 0x56789ABC + 0x12340 = 0x5679BDFC.
As for the 64-bit registers, as far as I'm aware, you can't use them at all in real mode. There's no instruction override prefix like there is to allow 32-bit registers to be used in a 16-bit mode.
Any other questions?
Re: How are addresses calculated in 32bit real mode?
Posted: Fri Jun 22, 2012 7:20 pm
by Mahkoe
No, that was exactly what I was looking for. Thanks a lot! Oh, actually, I do have a question. How do you mark threads as solved?
Re: How are addresses calculated in 32bit real mode?
Posted: Sat Jun 23, 2012 1:06 am
by Kazinsal
Edit your original post and change the subject line.