assemblyx86-16real-modememory-segmentation

physical address formula in 16 bit real mode: why multiply segment by 16?


physical address=16*selector+offset
but i don't know why multiplying 16 by selector?


Solution

  • In order to be "programmer-compatible" with the Z80, yet still be able to use more than 64 kiB of memory, early Intel processors introduced memory segmentation. The 16-bit segment would be shifted left 4 bits (meaning multiplication by 16, and not 64 as your question claims) before being added to the 16-bit offset, resulting in a 20-bit address.

    For programmers accustomed to the Z80, all that was required was to use the segments provided by the OS, and they would be able to use the given 64 kilobyte offset as they pleased. New programmers could do more sophisticated manipulation of the segments, allowing them to access 1 MiB of address space (the IBM PC cut it down to 640 kiB, but for their own reason).