Search code examples
x86x86-16real-modememory-segmentation

How does the segment:offset addressing scheme work?


I've read that in the days of the Intel 8086 CPU the biggest registers were 16-bits and everyone were looking for a way to access more than 65536 bytes of linear memory but instead of expanding the CPU registers they invented the segment:offset addressing scheme and the way I understand it you're able to "group" two 16-bit registers together into a 32-bit memory address. But the same place I have also read that the CPU could only access 1MB of memory. How does that work? 2^32 equals 4,294,967,296 so I don't understand, please enlighten me :)


Solution

  • The segment register value is shifted left by 4 (multiplied by 16) and added to the "offset" part of the address address.

    16 * 65536 = 1 megabyte.