Expanded Memory: What It Is and How It Worked
In this article
Expanded memory is a technique for adding memory to IBM PC and compatible computers from the 1980s and early 1990s, letting programs use more than the 640 KB that DOS normally allowed. It works by mapping a small window of memory into a reserved area of the CPU's address space and swapping data in and out of that window. The term is often confused with extended memory, but they are different technologies. This article explains what expanded memory actually is, how it works, why it existed, and how it compares to the alternatives.
Background: Why 640 KB Was a Problem
The original IBM PC, released in 1981, used an Intel 8088 processor. That CPU could address 1 MB of memory, but the PC's design reserved the upper 384 KB of that 1 MB for hardware: video memory, ROM BIOS, and expansion card addresses. The remaining 640 KB was available for the operating system and applications. DOS, the dominant operating system, was designed to run in real mode, where programs run in a single flat address space and can only see the first 1 MB.
As software grew more complex in the mid-1980s, especially spreadsheet programs like Lotus 1-2-3, users hit the 640 KB ceiling quickly. Memory was expensive, and simply adding more RAM to the motherboard did not help because DOS and real-mode programs could not address it. The industry needed a way to let ordinary programs use more memory without rewriting them for a protected mode that most PCs did not support.
The solution came from three competing approaches: expanded memory, extended memory, and later, memory managers that combined both. Expanded memory was the first widely used answer, and it remained important until 32-bit operating systems like Windows 95 made the whole problem moot.
How Expanded Memory Works
Expanded memory is a bank-switching scheme. A special hardware card (or later, a software emulator) provides a pool of memory, typically 2 MB to 8 MB, that is not directly addressable by the CPU. Instead, a small portion of the upper memory area—usually a 64 KB region between 640 KB and 1 MB—is set aside as a “page frame.” The page frame is divided into four 16 KB pages.
Software that uses expanded memory talks to a driver, typically EMM386.EXE or a hardware card's driver, which maps any four 16 KB pages from the expanded memory pool into the page frame. The program can then read or write to those pages as if they were ordinary memory, but every time it needs a different part of the pool, the driver swaps the pages. This is why expanded memory is sometimes called “banked memory.”
The programming interface for expanded memory was standardized by the Expanded Memory Specification (EMS), originally developed by Lotus, Intel, and Microsoft in 1985. The specification defined a set of software interrupts and functions that programs could call to allocate expanded memory, map pages, and release memory. The most common version was EMS 4.0, which added features like multiple page frames and the ability to map more than four pages at once.
Here is a simple example of how a program might use expanded memory:
- The program checks if an EMS driver is installed by calling interrupt 67h.
- It allocates a number of 16 KB pages from the driver.
- It sets the page frame address (if the driver lets it choose) or uses the default.
- It maps a page from the pool into one of the four slots in the page frame.
- It reads or writes data in that 16 KB window.
- It maps a different page in when it needs more data.
This approach allowed programs to access far more memory than the CPU could directly address, but it required the program to be written specifically to use the EMS API. Programs that were not written for EMS could not benefit from it.
Expanded vs. Extended Memory: What’s the Difference?
Expanded memory and extended memory are often confused because the names sound similar and both were used to get around the 640 KB limit. They are fundamentally different.
Extended memory is simply memory above the 1 MB address line. The Intel 80286 and later processors can address it, but only in protected mode. DOS itself runs in real mode, so it cannot use extended memory directly. However, programs can switch the CPU into protected mode temporarily, use the extended memory, and switch back. This is how memory managers like HIMEM.SYS and programs like Windows 3.0 in enhanced mode worked.
Expanded memory, on the other hand, does not require the CPU to switch modes. It uses the page frame in the upper memory area, which is within the first 1 MB. The CPU always remains in real mode, and the program sees only the 64 KB window. The expanded memory pool itself can be located on a hardware card (which has its own memory) or it can be simulated using extended memory (as EMM386 does).
Here is a quick comparison:
- Expanded memory: accessed via bank switching, requires EMS driver, works with real-mode programs, pool can be on a card or simulated.
- Extended memory: directly addressable above 1 MB, requires protected mode, used by memory managers and 32-bit operating systems.
In practice, many systems used both: HIMEM.SYS for extended memory and EMM386.EXE to simulate expanded memory using that extended memory. This let old EMS-only programs run on newer machines that did not have an expanded memory card.
How to Use Expanded Memory in DOS
If you are using a modern PC with DOS (for example, in a virtual machine or on vintage hardware), you can enable expanded memory with a memory manager. The standard setup uses two drivers in CONFIG.SYS:
- Install HIMEM.SYS first to manage extended memory. Add a line like
DEVICE=C:\DOS\HIMEM.SYSto CONFIG.SYS. - Install EMM386.EXE to simulate expanded memory. Add a line like
DEVICE=C:\DOS\EMM386.EXE RAMto CONFIG.SYS. TheRAMparameter enables expanded memory and also provides access to the upper memory blocks. - Reboot the computer. The memory manager will report how much expanded memory is available.
- Programs that support EMS can then use it. Many games and productivity applications have a setup program where you can tell them to use expanded memory.
Note that the exact syntax of EMM386.EXE can vary by version. The RAM option is standard, but you may also see NOEMS (which disables expanded memory but still gives upper memory access) or FRAME= to set a specific page frame address. If you are using a hardware expanded memory card, you would install its own driver instead of EMM386.
It is important to know that not all programs can use expanded memory. Some only use extended memory, and some use neither. You must check the program’s documentation to see what it supports. Also, expanded memory is not the same as “high memory” (the first 64 KB of extended memory) or “upper memory blocks” (unused areas in the 640 KB–1 MB region). Those are separate features of memory managers.
Common Problems and Misconceptions
One common misconception is that expanded memory is the same as “extra memory” or that it is a type of RAM you can buy today. In reality, expanded memory is a specific software/hardware interface that is obsolete. Modern computers and operating systems handle memory entirely differently, and there is no need for expanded memory.
Another issue is that people often confuse the terms in old game manuals. Many games from the late 1980s and early 1990s ask you to select “EMS” or “XMS” during installation. If you choose the wrong one, the game may not run or may crash. The correct choice depends on what your system has. If you have EMM386 loaded, you have EMS. If you have HIMEM but not EMM386, you only have XMS.
A common problem when using EMM386 is that it can conflict with other drivers that use the upper memory area. For example, a network card or sound card might occupy the same address range as the page frame. The solution is to exclude that range in EMM386.EXE using the X= parameter, or to move the page frame to a different address with FRAME=. This is a trial-and-error process, and it is why many users found configuring memory managers frustrating.
If you are running DOS in a virtual machine, expanded memory may or may not be available. Some virtual machines (like DOSBox) emulate expanded memory directly, while others do not. In DOSBox, you can enable EMS with the ems=true setting in the configuration file. In Microsoft Virtual PC, you can add expanded memory by editing the VM’s settings. Always check the documentation for your specific virtual machine.
Alternatives to Expanded Memory
Expanded memory was not the only solution to the 640 KB limit. The main alternatives were:
- Extended memory (XMS): Used by programs that could switch to protected mode, such as Windows 3.0 and DOS extenders. This was the path forward, as it allowed direct access to all memory above 1 MB.
- DOS extenders: These allowed 32-bit programs to run in protected mode under DOS, giving them access to all available memory. Many games and professional applications used DOS extenders.
- Memory managers that combine both: HIMEM and EMM386 together provided XMS and simulated EMS, so programs with either requirement could run.
- 32-bit operating systems: Windows 95 and later, as well as OS/2, ran in protected mode and did not need expanded memory at all. They used a flat memory model where all RAM is directly accessible.
For modern users, the only reason to care about expanded memory is to run old software in a virtual machine or on vintage hardware. In that context, using a memory manager like EMM386 is the standard way to provide EMS.
Frequently Asked Questions
Is expanded memory the same as extended memory?
No. Expanded memory uses bank switching through a page frame in the upper memory area, while extended memory is directly addressable above 1 MB in protected mode. They are different technologies with different programming interfaces.
Can I use expanded memory on a modern PC?
Not directly, because modern operating systems do not support the EMS interface. However, you can run DOS in a virtual machine (like DOSBox or VirtualBox) and enable EMS emulation there. On real hardware, you would need an ISA expansion card, which is not practical.
Why did old games ask for EMS or XMS?
Games used expanded memory as a fast storage area for game data, sound samples, or map data. XMS was used by programs that could switch to protected mode. The choice depended on what the developer programmed for. Many games supported both, and you could pick whichever your system had.
How much expanded memory did typical systems have?
Expanded memory cards typically came in sizes of 2 MB, 4 MB, or 8 MB. When using EMM386 to simulate EMS, the amount depended on how much extended memory you had. The EMS specification allowed up to 32 MB, but most programs only used a few megabytes.
Does expanded memory still exist in any form today?
No, it is obsolete. Modern CPUs and operating systems use a flat memory model with no 640 KB limit. The only place you will encounter expanded memory is in emulators, vintage hardware, or old documentation.