1

Me and my friend were brainstorming about a question concerning physical memory addressing in real mode and we couldn't wrap our heads around it. Here goes.

In real mode 16 is multiplied to the segment selector register and added to the offset register to get the 20-bit physical address. This consequently leads to the possibility of overlapping segments.

E.G. "Segment Selector -> 0040 & Offset -> 0010" = "Segment Selector -> 0030 & offset -> 0110"

It is our understanding that the segment selector is shifted by 4 bits before being added to the offset. So in order to avoid this segmentation why didn't they just shift the segment selector by 6 (multiply it by 64) before adding it to the offset. In our view this would have eliminated the prospect of memory overlapping.

Does it have to do with any hardware limitations they faced during that time or is it simply a design decision.

Micky
  • 63
  • 4

2 Answers2

1

It's due to the design constraints. They had a 20-bit address bus, the simplest thing to do was simply to have the segment register select the paragraph, then add the offset to it (and for the parts that exceed the 20-bit address bus, it wraps around into the bottom of memory).

Brian Knoblauch
  • 20,639
  • 15
  • 57
  • 92
  • That's right. Keep in mind they were trying to reach 1 MB of memory address space (20 bits) with 16 bits registers!!!. The most efficient way to accomplish that was using 'segmentation' with the segment base part being 'shifted' 4 bits to the left. The overlapping you point as something to avoid at all costs is not as bad as you think!. Consider that you can define small segments (some bytes long) as well as large segments (near 64kB long) with that scheme. – fante Sep 22 '15 at 18:51
1

Shifting by 4 gave you an address space of a whole megabyte. Wow!

The design was done at a time when the 8-bit systems were configured with 64 kB, for those rich enough to buy that much memory. And with a big enough box to fit all those memory boards.

Here's what 16 kB looked like: http://www.s100computers.com/Hardware%20Folder/CCS/16K%20RAM/16K%20RAM.htm

If you were to install 4 MB, you would first have to rent another room to store the memory boards!

Bo Persson
  • 90,663
  • 31
  • 146
  • 203
  • Nowadays you can buy a whole computer and have money left over with the same amount of money my first 4MB configuration of RAM cost! – Brian Knoblauch Apr 15 '11 at 13:43