Classic PC Games Support

DOS Memory Management

How DOS Memory Management Works?

Memory Types.

There are five types of memory DOS uses. These are Conventional Memory, Upper Memory (UMB,) High Memory Area (HMA,) Extended Memory (XMS) and Expanded Memory (EMS.) These pieces of memory are divided into two sections: Less than 1MB and Above 1MB. The conventional, UMB and HMA portions of memory make up the Less than 1MB range. The XMS and EMS portions of memory make up the Above 1 MB range.

Memory Manager.

Without any memory managers loaded, DOS can only use 640k of RAM. This is known as conventional memory. The memory manager HIMEM.SYS allows DOS to use RAM over 1MB. For example, if a computer, has 64MB of RAM, HIMEM.SYS will allow DOS to recognize the 1 through 64MB range of memory. This range of memory is known as XMS. HIMEM.SYS also creates the High Memory Area. The High Memory Area is a 64k portion of RAM that makes up the first MB of RAM. HIMEM.SYS should be loaded for almost any program running.

EMM386.

EMM386 is the Expanded Memory Manager. It creates and manages the UMB, as well as converts the XMS memory to EMS memory. The UMB can be used to load drivers into it. Since there is only 640k of conventional memory that can be used to load a driver, memory managers, other environmental settings and finally run the game executable, this 640k can be a precious resource. If the UMB has extra room, loading drivers in this section can free up space in conventional memory. XMS memory will also be converted into EMS memory.

How to conserve conventional memory?

Conventional Memory is the first 640k of your RAM. This is the space where you load drivers and the game executable. If you type MEM /C /P in DOS, it will display how much of each type of memory has free space, which programs may be loaded and how much memory each one is using.

If too many programs or DOS settings are being used, the game may not have enough conventional memory to launch. If this is the case, you may need to be more economical in how the memory is spent.

DOS requires 18k to load. If you load HIMEM.SYS, you should use the DOS=HIGH line. This will place the 18k of DOS into the HMA.

EMM386 is a very useful memory manager for conserving conventional memory. EMM386 will create the Upper Memory Blocks. Some drivers can be loaded into the UMB rather than taking up space in conventional memory. For this to happen, you first need to have 2 lines in the config.sys that read:

DEVICE=C:\WINDOWS\EMM386.EXE RAM 3072 I=B700-B7FF
DOS=HIGH, UMB

This line will create about 160k of free upper memory space. EMM386 will take up about 19k of conventional memory to load. the I= portion of this line will allow a 32k chunk of memory to be available. This is a good trade if you can displace more than 10k of memory. The DOS=UMB line will allow DOS to use the upper memory blocks to load drivers into. EMM386 may conflict with some games that have their own memory manager built in.

To specify a driver to use upper memory, you need to use the DEVICEHIGH= or LH prefix before the file you wish to load. For example:

Config.sys:

DEVICEHIGH=C\WINDOWS\COMMAND\EBD\OAKCDROM.SYS /D:MSCD001

Autoexec.bat:

LH C:\DRIVERS\MOUSE.EXE

These lines will attempt to load the CD-ROM drive and the mouse driver to the upper memory. If upper memory is full or unavailable to load into this section, the driver will load normally into conventional memory. So there is no harm in using LH or DEVICEHIGH when loading a file.

When using the BUFFERS= and FILES= lines, each numerical value will take up 512 bytes. So if BUFFERS=30 and FILES=30, this will take up a total of 30k of conventional memory. The game will require a minimum setting, but setting these too high is a waste of memory.

Each reserved drive letter will take up 1k of conventional memory. Unless specified, DOS reserves 26 letters, taking a total of 26k of conventional memory. If the last drive letter on your computer is D:, you can force DOS to recognize the last possible drive letter being D:.

For example, in the config.sys, you can use a line that states:

LASTDRIVE=D

This will conserve 22k of conventional memory.

So be aware of the size of the drivers, memory managers and more importantly, the game executable, and that the memory can be manipulated to run most programs.