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
How are addresses calculated in 32bit real mode?
- Kazinsal
- Member
- Posts: 559
- Joined: Wed Jul 13, 2011 7:38 pm
- Libera.chat IRC: Kazinsal
- Location: Vancouver
- Contact:
Re: How are addresses calculated in 32bit real mode?
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?
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?
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?
- Kazinsal
- Member
- Posts: 559
- Joined: Wed Jul 13, 2011 7:38 pm
- Libera.chat IRC: Kazinsal
- Location: Vancouver
- Contact:
Re: How are addresses calculated in 32bit real mode?
Edit your original post and change the subject line.