After watching some 486 build videos, it became clear to me that optimizing DOS memory is a lost art. Yes, I made some boot menus and custom DOS boot disks in my day, but for power users, that was usually a last resort. Memory managers usually free up more than 600K of conventional memory so DOS programs run great. Here’s how to use them.
The key is using HIMEM.SYS and EMM386.EXE in your config.sys with certain recommended parameters. These programs move device drivers and memory-resident utilities out of conventional memory to make room for memory-hungry DOS programs. Using HIMEM.SYS and EMM386.EXE is a bit of a lost art, so let’s see if we can un-lose it.
What is a memory manager?
DOS has several types of memory. Bill Gates is famously lampooned for his statement that 640K ought to be enough for anybody. He didn’t mean forever and ever when he said that. He was referring to the way IBM decided to lay out the memory for the original IBM PC. The Intel 8088 could address 1 megabyte of RAM, and IBM needed to save some of that space for the system itself. So IBM reserved 384K for the system and left 640K for user programs. Considering the IBM PC originally shipped with as little as 16K of RAM, that seemed like a pretty reasonable way to divide things up. That’s all Gates was saying.
The IBM PC succeeded beyond anyone’s wildest expectations, and by the early 1990s, 640K wasn’t really enough for some people. By the time you loaded drivers for your sound card and CD-ROM drive and other things you needed, sometimes you didn’t have enough memory left to run software that pushed DOS’ limits.
Memory managers use various tricks to steal back some of that 384K of memory that IBM reserved. By loading parts of DOS and your drivers for your sound card and CD-ROM drive and whatever else you load in config.sys and autoexec.bat into that off-limits space, you can free up more of that precious 640K.
Microsoft included utilities in DOS 5 and DOS 6 to do this. They were called HIMEM.SYS and EMM386.EXE. Some power users preferred to use third-party memory managers instead. More on those in a bit.
For general use, these lines in config.sys suffice to enable and take full advantage of HIMEM.SYS:
The first line loads HIMEM.SYS and instructs it not to run a memory test. This provides you the fastest boot time possible. If you’re concerned about reliability, omit that parameter. Way back when, I always used it.
The second line tells DOS to load itself into high memory and enable the use of upper memory blocks.
But to take full advantage of HIMEM.SYS, you also need to load its counterpart, EMM386.EXE. Here’s the most generally useful config.sys line to enable it:
This loads EMM386 and tells it to emulate EMS memory using XMS memory. Some programs need both.
If you don’t run any DOS software that uses EMS memory, you can save 64K of precious upper memory by using this instead:
This instructs EMM386 to skip emulating EMS.
Optimizing the rest of config.sys and autoexec.bat
To take full advantage of HIMEM.SYS and EMM386.EXE and load drivers into upper memory, edit config.sys and look for any lines that start with DEVICE=. Any of those lines except for the ones that load HIMEM.SYS and EMM386.EXE are candidates to change to DEVICEHIGH=. For example:
SHELL=C:\DOS\COMMAND.COM /C LH C:\DOS\COMMAND.COM /E:512 /P
The first line loads command.com into high memory, an extremely poorly documented trick that works in DOS 5 and newer.
The next two lines load the nearly-universal Oak CD-ROM driver for IDE drives into high memory, then loads the Microsoft mouse driver into memory. Loading mouse.sys in config.sys is more memory efficient than running the executable version in autoexec.bat.
Then, edit autoexec.bat and look for any programs it calls. You can precede those with the LH command to load them into upper memory.
lh c:\dos\mscdex.exe /d:cdrom
This loads the Microsoft CD-ROM extensions into upper memory, along with the very useful DOSKEY utility, which gives you command history.
To verify how much difference it made, run the MEM command before and after you reboot and compare the difference. You’ll probably go from under 600K of conventional memory available to around 620K if you don’t use EMS, or 607K if you do. Very few programs need more than 620K free, and most are just fine with 607K.
What about Memmaker?
DOS 6.22 came with a utility called Memmaker. Instead of manually hacking config.sys and autoexec.bat, you can simply run Memmaker and let it optimize DOS memory for you. Just boot up DOS and type memmaker at the C prompt. It will optimize your startup files automatically. It may need to reboot several times.
Depending on the complexity of your startup files and various quirks your computer may have, it can do a better job than you could do by hand. Sometimes it will do worse. But it’s easy, and adequate. I knew a lot of people who used it to optimize DOS memory.
Optimizing DOS memory with QEMM
Power users in the 90s would sometimes forego Microsoft’s memory manager and go with QEMM, a more powerful alternative from Quarterdeck. QEMM used software tricks to get more memory than Microsoft’s tools would. Some people claim QEMM is 20% faster than Microsoft’s version while others claim it’s up to 20% slower. It probably depends on your hardware. You can always try both to see which one runs your favorite games better. It also makes less of a difference today since we can throw more hardware at it more easily than we could in the early 90s.
With QEMM you always want to enable EMS, since it uses EMS to swap things in and out of upper memory, so you gain more than the 64K you give up to have EMS.
Here’s a QEMM-enabled config.sys:
DEVICE=C:\QEMM\QEMM386.SYS R:1 RAM
DEVICE=C:\QEMM\LOADHI.SYS /R:2 C:\QEMM\QDPMI.SYS SWAPFILE=DPMI.SWP SWAPSIZE=1024
DEVICE=C:\QEMM\LOADHI.SYS /R:2 C:\DRIVERS\OAKCDROM.SYS /D:CDROM
SHELL=C:\QEMM\LOADHI.COM /R:2 C:\DOS\COMMAND.COM C:\DOS\ /E:2048 /P
And here’s a QEMM-enabled autoexec.bat:
C:\QEMM\LOADHI /R:2 C:\DOS\MSCDEX /D:CDROM /M:18 /E /S /L:G /V
C:\QEMM\LOADHI /R:2 /LO C:\DOS\SMARTDRV 2048 128 /V
C:\QEMM\LOADHI /R:2 C:\DOS\MOUSE /1 /A3
C:\QEMM\LOADHI /R:2 C:\DOS\DOSKEY /INSERT
SET BLASTER=A220 I5 D1 H5 P330 T6
With QEMM it’s possible to get over 630K of free conventional memory. You’d be hard pressed to optimize DOS memory much more than that.