Configuring your MS-DOS PC for gaming (CONFIG.SYS and AUTOEXEC.BAT)
Getting MS-DOS games to work can be hard, since MS-DOS memory management is not easy. Depending on what your games need, a multi-boot set-up probably works best. This article dives into the nuances of MS-DOS memory management and works towards a set-up that should enable all your games.
The basics
There are several basic concepts you need to understand before MS-DOS memory management makes sense:
- Real mode. x86 processors start up in what's known as real mode. In real mode the CPU uses segment:offset addressing, which results in 20-bit addresses, so it can directly address 1 megabyte (MB) of memory. This still holds true for modern CPUs such as the i7: they also boot in real mode, purely for backwards compatibility with the 8086. You need to switch to protected mode to address more memory. MS-DOS itself runs in real mode, which is why everything above 1 MB needs special tricks to reach. The IBM PC (the grandfather of the modern PC) made a design choice for that 1 MB: the first 640 KB is for RAM, the remaining 384 KB is reserved for hardware such as video memory and ROMs (system BIOS, video BIOS, etc.).
- Conventional memory is the first 640 kilobytes (KB) of memory. MS-DOS can use it just fine and there are no ROMs in this area. Not all of it is free though: the interrupt vector table, the BIOS data area, DOS itself and every driver and TSR you load take their share. Many games, especially from 1993/1994 onwards, need more free conventional memory than a default set-up gives you, and often extended or expanded memory on top of that.
- The Upper Memory Area (UMA) is the 384 KB between 640 KB and 1 MB. The processor can address it directly, but it is reserved for hardware: video memory (the RAM on your video card), the video card BIOS, other adapter ROMs and the system BIOS. By default no system RAM is mapped to this area. Even if you have 1 MB installed, the 'extra' 384 KB is not mapped here: it sits above the 1 MB mark as extended memory.
- Upper Memory Blocks (UMBs) are the unused gaps in the UMA. They only become usable when a UMB provider maps RAM into them: EMM386 on a 386 or higher, or the memory controller of some 286 chipsets (with its own driver). DOS can then load device drivers and TSRs into them, using
DOS=UMBin config.sys andDEVICEHIGH/LOADHIGH, which frees up conventional memory. - Extended memory is the memory above 1 MB. Real-mode DOS programs can't use it until you load HIMEM.SYS as a device driver, which manages it through the XMS interface (HIMEM only works on 80286 class CPUs or higher). Games built on a DOS extender such as DOS/4GW run in protected mode and need extended memory.
- The High Memory Area (HMA) is the first 64 KB minus 16 bytes of extended memory. Real-mode code can reach it by enabling the A20 address line, which HIMEM.SYS does for you.
DOS=HIGHin config.sys loads the DOS kernel into the HMA, which frees up tens of KB of conventional memory. Note that this is the HMA, not the UMBs. - Expanded memory (EMS) is an older, bank-switched type of memory. A 64 KB page frame in the UMA acts as a window into a larger pool of memory. On an 8086 or 286 you need a hardware EMS board (or chipset support) for this; on a 386 or higher EMM386 can emulate it using extended memory.
8086
If you have an 8086/8088 system with 640 KB or less, configuring your system is quite trivial. HIMEM, EMM386 and UMBs are all out of reach, so there isn't much you can do to improve memory. Load the drivers you need - most games on these machines aren't memory hogs anyhow. The only way to get more memory is a hardware EMS board.
80286
A 286 can address extended memory, so HIMEM.SYS works. EMM386.EXE does not: it needs the V86 mode and paging of the 386. That also means there are no UMBs on a plain 286 (some chipsets can provide them with their own driver, so check your board). DEVICEHIGH and LOADHIGH have nothing to load into, so drivers stay in conventional memory.
If your system has more than 640 KB of RAM, this configuration makes extended memory available and loads the DOS kernel into the HMA to free up conventional memory.
CONFIG.SYS:
DEVICE=C:\DOS\HIMEM.SYS DOS=HIGH FILES=30 BUFFERS=20 LASTDRIVE=E STACKS=9,256
AUTOEXEC.BAT:
@ECHO OFF PROMPT $P$G SET TEMP=C:\TEMP PATH=C:\DOS;C:\UTIL C:\DOS\SMARTDRV.EXE 1024 C:\MOUSE\MOUSE.COM
A few notes:
SMARTDRV.EXE 1024creates a 1 MB disk cache in extended memory (MS-DOS 6.x), which assumes at least 2 MB of RAM. With 1 MB installed you only have 384 KB of extended memory, and the HMA takes 64 KB of that, so use a smaller cache, for exampleSMARTDRV.EXE 256.- If HIMEM.SYS complains about the A20 line on your board, use its
/MACHINE:switch to select your machine type. - Adjust the paths to where your DOS files live.
80386 and higher
From the 386 onwards, EMM386.EXE can turn extended memory into both UMBs and EMS. This is the usual set-up for loading drivers out of conventional memory:
CONFIG.SYS:
DEVICE=C:\WINDOWS\HIMEM.SYS DOS=HIGH,UMB DEVICE=C:\WINDOWS\EMM386.EXE RAM AUTO I=B000-B7FF DEVICEHIGH=C:\UTILS\CDROM\VIDE-CDD.SYS /D:MSCD001
AUTOEXEC.BAT:
@ECHO OFF LH C:\UTILS\CDROM\MSCDEX.EXE /D:MSCD001
DOS=HIGH,UMBloads the DOS kernel into the HMA and lets DOS use the UMBs.RAMmakes EMM386 provide both UMBs and EMS. UseNOEMSinstead if you only want UMBs: you get more upper memory because there is no 64 KB EMS page frame, but programs that need EMS won't run.AUTOmakes EMM386 provide expanded memory only when a program asks for it.I=B000-B7FFadds the unused monochrome text area to the upper memory pool, which gives you roughly 32 KB extra. Only do this when you have a colour/VGA video card and no monochrome adapter.DEVICEHIGHloads the CD-ROM driver into upper memory. You also needMSCDEXin AUTOEXEC.BAT to get a drive letter for it; the/D:MSCD001name has to match the one in config.sys.- Paths: C:\DOS is typical for MS-DOS 5 and 6, C:\WINDOWS for the DOS of Windows 9x. Adjust them to your system.
EMM386 runs DOS in virtual 8086 mode, and some games don't like that. Others need EMS, or as much conventional memory as possible with nothing but HIMEM loaded. That is exactly why a multi-boot set-up works best.
Conclusion: one PC, several configurations
No single configuration suits every game. EMS-hungry games want EMM386 with the RAM option, most later games are happiest with NOEMS and as many drivers as possible in upper memory, and a few refuse to run next to a memory manager at all. Instead of editing config.sys every time you switch games, you can let DOS ask you at boot time. MS-DOS 6.0 and later (including the DOS of Windows 9x) support this with a menu in CONFIG.SYS.
How the boot menu works
- The
[MENU]block defines the choices. EveryMENUITEM=name, descriptionline adds one entry, andMENUDEFAULT=name, secondspicks the default and how long DOS waits before booting it. - Every menu item needs a block with the same name (
[NOEMS],[EMS], ...), even if that block is empty. Only the lines in the selected block are executed. - Lines in
[COMMON]are executed for every choice. - DOS stores the name of the selected item in the
CONFIGenvironment variable. AUTOEXEC.BAT uses it to jump to the right section withGOTO %CONFIG%.
Example: four profiles
CONFIG.SYS:
[MENU] MENUITEM=NOEMS, 1. EMM386 without EMS - most games MENUITEM=EMS, 2. EMM386 with EMS - Wing Commander I and II MENUITEM=XMS, 3. HIMEM only, no EMM386 - Ultima VII MENUITEM=CLEAN, 4. Clean boot - no memory drivers at all MENUDEFAULT=NOEMS, 10 [COMMON] FILES=40 BUFFERS=20 LASTDRIVE=E [NOEMS] DEVICE=C:\WINDOWS\HIMEM.SYS DOS=HIGH,UMB DEVICE=C:\WINDOWS\EMM386.EXE NOEMS I=B000-B7FF DEVICEHIGH=C:\UTILS\CDROM\VIDE-CDD.SYS /D:MSCD001 [EMS] DEVICE=C:\WINDOWS\HIMEM.SYS DOS=HIGH,UMB DEVICE=C:\WINDOWS\EMM386.EXE RAM I=B000-B7FF DEVICEHIGH=C:\UTILS\CDROM\VIDE-CDD.SYS /D:MSCD001 [XMS] DEVICE=C:\WINDOWS\HIMEM.SYS DOS=HIGH [CLEAN]
AUTOEXEC.BAT:
@ECHO OFF PROMPT $P$G SET TEMP=C:\TEMP PATH=C:\WINDOWS;C:\WINDOWS\COMMAND;C:\UTIL GOTO %CONFIG% :NOEMS LH C:\UTILS\CDROM\MSCDEX.EXE /D:MSCD001 LH C:\MOUSE\MOUSE.COM GOTO END :EMS LH C:\UTILS\CDROM\MSCDEX.EXE /D:MSCD001 LH C:\MOUSE\MOUSE.COM GOTO END :XMS C:\MOUSE\MOUSE.COM GOTO END :CLEAN C:\MOUSE\MOUSE.COM GOTO END :END
Notes on this example:
- The XMS and CLEAN profiles don't load a CD-ROM driver on purpose: without UMBs every driver eats conventional memory, and the games that need these profiles are the ones that need that memory most. The mouse driver is the only thing left in AUTOEXEC.BAT.
- The EMS profile uses the
RAMoption and lets EMM386 pick the EMS page frame. If it conflicts with a card in your system, addFRAME=with a free address (for exampleFRAME=E000). - As before, adjust all paths and the CD-ROM driver to your own system.
Which game needs which profile
| Game | Profile | Why |
|---|---|---|
| Ultima VII: The Black Gate | 3 (HIMEM only) or 4 (clean) | It brings its own memory manager, Voodoo, which is incompatible with EMM386 (and with QEMM and 386MAX). HIMEM.SYS can stay loaded. The game also needs roughly 524,000 bytes of free conventional memory (about 561,000 with sound and speech options), so keep AUTOEXEC.BAT minimal. |
| Wing Commander I and II | 2 (EMM386 with EMS) | These games use expanded memory (EMS), so they need EMM386 with the RAM option. |
| Doom, and other games built on the DOS/4GW extender | 1 (EMM386 without EMS) | The extender uses extended memory (XMS) and doesn't need EMS. NOEMS gives you the most upper memory for drivers. |
| Later games that need a lot of free conventional memory while using mouse, CD-ROM and sound drivers | 1 (EMM386 without EMS) | UMBs let you load the drivers high, and without an EMS page frame there is more upper memory available for them. |
These are examples, not a complete compatibility list, and requirements can differ per release of a game. Always check the manual or readme for words like EMS, XMS, free conventional memory, or 'no memory manager', and use those as a guide for choosing a profile.
Verify each profile
After booting a profile, run MEM /C /P and look at the largest executable program size. That is the number that matters for conventional memory. The CLEAN profile will show the least, because DOS itself stays in conventional memory there, while NOEMS (drivers loaded high) and XMS (hardly any drivers) should show the most. Also check that EMS shows up in the EMS profile and not in the others. If a game still refuses to run, work through the profiles from 1 to 4: each step removes more software from between the game and the hardware.