mgiuca
mgiuca

Reputation: 21377

How did x86 real mode work on machines with <640K of RAM?

This question is mostly for historical interest, but I have been unable to find any documentation about it. All the documentation I can find on x86 real mode (including the Intel manual [1] and online memory maps [2]) assumes 640KiB of system memory. Yet the original IBM PC had just 16KiB or 64KiB of RAM [3].

How did this work? Two specific questions:

  1. How did the CPU behave if memory was accessed that did not exist? The Intel manual [1] states, for real mode, for some instructions that #GP (general protection fault) is triggered "If a memory operand effective address is outside the CS, DS, ES, FS, or GS segment limit", and for others, "If any part of the operand lies outside the effective address space from 0 to FFFFH." That doesn't seem to suggest that you can get a #GP for accessing well-addressed memory that does not exist. So what does the CPU do in this case?
  2. According to the memory map [2], the BIOS typically loads the MBR to 0x7c00, which is outside of the memory space of the original "cheap" IBM PC with only 16KiB of RAM. How did it cope with this? (Was the BIOS design initially not loading code to 0x7c00?)

[1] http://www.intel.com/content/www/us/en/processors/architectures-software-developer-manuals.html

[2] http://wiki.osdev.org/Memory_Map_(x86)

[3] http://en.wikipedia.org/wiki/IBM_Personal_Computer#PC

Upvotes: 3

Views: 440

Answers (1)

Hans Passant
Hans Passant

Reputation: 942255

The 8088 processor directly addressed the RAM, there was no MMU or any circuit that told the processor that it was accessing an invalid address. So the program just read garbage, typically 0xff. Unlikely to last for long after that :)

The original IBM PC with 16 KB RAM was sold without any disk drives. So it just didn't matter that the boot address was not valid. The user was expected to only use the ROM Basic. It was not very popular. If you purchased it with a floppy disk, the "business use" configuration, then you automatically also got 64 KB RAM included. So the address was valid. That configuration cost $7,795 in today's prices :)

Also noted on this web page.

Upvotes: 8

Related Questions