Search code examples
assemblyx86x86-16real-modememory-segmentation

What are the segment and offset in real mode memory addressing?


I am reading about memory addressing. I read about segment offset and then about descriptor offset. I know how to calculate the exact addresses in real mode. All this is OK, but I am unable to understand what exactly offset is? Everywhere I read:

In real mode, the registers are only 16 bits, so you can only address up to 64k. In order to allow addressing of more memory, addresses are calculated from segment * 16 + offset.

Here I can understand the first line. We have 16 bits, so we can address up to 2^16 = 64k.

But what is this second line? What the segment represent? Why we multiply it with 16? why we add offset. I just can't understand what this offset is? Can anybody explain me or give me link for this please?


Solution

  • Under x86 Real-Mode Memory the physical address is 20 bit long and is therefore calculated as:

    PhysicalAddress = Segment * 16 + Offset
    

    Check also: Real-Mode Memory Management