DOS veterans may remember messing with expanded and extended memory to get memory above 640K. Here’s what you need to know about expanded vs extended memory, or EMS vs XMS. They are two different approaches to solving the same problem.
In 1980, Bill Gates infamously said 640K ought to be enough for anybody. Then along came Lotus 1-2-3. In time, 640K wasn’t enough for a data-hungry analyst. And once extra memory became popular, games started using it too. Today, the main reason people worry about expanded or extended memory is to get their classic DOS games running.
A primer on DOS memory types
8086-series CPUs running MS-DOS used several types of memory. The first 640K of memory was called conventional memory. This block of memory just worked, regardless of the CPU you had.
The memory between 640K and one megabyte was called upper memory. Software could use this memory without too much trickery. You just had to have memory in that reserved space and had to know how to make DOS use it.
Memory beyond the first megabyte was one of two other standards: expanded memory (LIM/EMS) or extended memory (XMS).
The dawn of 32-bit operating systems meant we didn’t have to worry about this anymore. But for a pre-1995 PC experience, you do.
Advantages of expanded memory
Expanded memory was originally called LIM memory, for Lotus-Intel-Microsoft, who co-developed a hack to permit an 8088 or 8086 CPU to use more than a single megabyte of memory. Expanded/LIM/EMS memory defines a space in the range between 640K and one megabyte and then uses it as a window into a much larger bank of RAM.
The advantage is that it allows an 8088 or 8086 CPU to address far more memory than its original design allowed. Some power users put two or more megabytes of RAM in their PC and XT-class machines, at considerable difficulty and expense, of course.
Disadvantages of expanded memory
The problem with expanded memory was that you had to access it in comparatively tiny quantities. It was much faster than swapping out to disk, but it had more overhead than using the standard 640K of RAM. It was a hack job–a workaround until a better solution came available. The approach was very similar to the approach Commodore used with its 8-bit RAM expansion.
Advantages of extended memory
Extended memory is different. 286 and newer CPUs could address more than a megabyte of RAM. So what they did was leave a hole in memory between 640K and 1 MB, then put the rest of their memory up above 1 megabyte. Extended memory referred to that memory above 1 megabyte. Getting that memory to work and remain backward compatible with legacy MS-DOS took a little time, but software developers are clever.
Extended memory is a contiguous block, so you can address it much more easily than expanded memory. You can run code out of extended memory too. It took some trickery, but memory for code and data is more useful than memory just for data.
And by tweaking one line of config.sys, you can make extended memory emulate expanded memory, as long as you have a 386 or better CPU. Just use this line in config.sys:
There’s overhead involved, but if the game you want to play uses EMS instead of XMS, that gets it working.
If you don’t need EMS, use this line:
This saves you some upper memory for device drivers. Here are some more tips for optimizing DOS memory.
Disadvantages of extended memory
Extended memory did require at least a 286, and ideally a 386 or better CPU. Over time that didn’t matter, as faster CPUs went mainstream. With a 286 you had to choose to configure your memory as one or the other, but a 386 could emulate expanded memory using extended memory, albeit with a slight performance hit. That became less of a problem as CPUs got faster.
Overall, extended memory was the better of the two standards. But the one you need really depends on the software you run, and the machine you’re using.