How to Configure Upper Memory Blocks in MS-DOS 5.0–6.22 Using EMM386.EXE
Learn how to free conventional memory in MS-DOS 5.0–6.22 by configuring Upper Memory Blocks with EMM386.EXE, including exact CONFIG.SYS lines, verification steps, and recovery tips.
17 Jul 2025, 12:44 UTC

Problem and Immediate Takeaway
You are running MS-DOS 5.0–6.22 and need more free space in the 0‑640 KB conventional memory area for large programs. Loading device drivers and TSRs into the Upper Memory Area (UMA) with EMM386.EXE can free enough conventional memory for a 600 KB executable to start without “Out of memory” errors.
Prerequisites
- CPU: 80386 or later (required for V86 mode).
- HIMEM.SYS must be loaded first in CONFIG.SYS to manage extended memory (XMS).
- At least 1 MB of extended memory must be present.
- CONFIG.SYS must contain a DEVICE=HIMEM.SYS line before any DEVICE=EMM386.EXE line.
Step‑by‑Step Procedure
1. Edit CONFIG.SYS
Open CONFIG.SYS with a text editor (e.g., EDIT.COM). Add or adjust the following lines, replacing the paths with your actual DOS installation directory:
DEVICE=C:\DOS\HIMEM.SYS /TESTMEM:OFF
DEVICE=C:\DOS\EMM386.EXE RAM I=B000-B7FF DOS=UMB
Explanation of each token:
- DEVICE= tells DOS to load a driver into memory.
- HIMEM.SYS enables extended memory; the /TESTMEM:OFF switch disables its memory test to speed boot.
- EMM386.EXE is the standard UMB provider that ships with MS-DOS 5.0 and later.
- RAM enables the UMB feature.
- I=B000-B7FF reserves the video ROM region (B000‑B7FF) for UMB usage; adjust this range if your video card uses a different address.
- DOS=UMB tells DOS to place its kernel and buffers in the UMA after boot.
2. Reboot the System
Save CONFIG.SYS and restart the computer. DOS will load HIMEM.SYS, then EMM386.EXE, creating the UMA.
3. Load Drivers/TSRs into UMBs
After the system has booted, add the following lines to AUTOEXEC.BAT (or run them manually at the command prompt) to place drivers and TSRs in the UMA:
DEVICEHIGH=C:\DOS\ANSI.SYS
LH C:\DOS\SMARTDRV.EXE
DEVICEHIGH and LH (load high) commands tell DOS to load the specified program into the UMA instead of conventional memory.
4. Verify the Configuration
Run the following command to see how much conventional memory is free and whether the UMA is being used:
MEM /C /P
Key things to check in the output:
- “Upper Memory Area” should show free blocks.
- Under “Programs using Upper Memory” you should see entries such as ANSI.SYS and SMARTDRV.EXE.
- The “Largest executable program size” line should report more than 580 KB of free conventional memory (e.g., 600 KB).
5. Test a Large Application
Launch a program that previously failed due to insufficient conventional memory, for example a 600 KB .EXE. If it starts without an error, the UMB configuration is successful.
Recovery Options
If the system hangs after editing CONFIG.SYS or AUTOEXEC.BAT, use one of the following methods to bypass the startup files:
- Press F5 during the “Starting MS-DOS...” message to skip CONFIG.SYS and AUTOEXEC.BAT entirely.
- Press F8 to step through each command; this lets you isolate the problematic line.
To recover, edit CONFIG.SYS and either:
- Remove the EMM386 line temporarily, save, and reboot.
- Adjust the UMA reservation range (the I= or X= parameter) to exclude a hardware region that may be causing conflicts (e.g., change I=B000-B7FF to I=C000-FFFF if your video card uses B000‑B7FF).
- Add the
NOEMSswitch to EMM386 if you do not need EMS emulation, which can free additional UMBs:
DEVICE=C:\DOS\EMM386.EXE NOEMS
Limitations and Practical Checks
The UMA is limited to the 640 KB–1 MB range. If a hardware device reserves part of that range (such as a video card’s BIOS ROM), you must adjust the I= or X= ranges accordingly, testing each change incrementally to avoid hangs.
Some TSRs, especially older mouse drivers or certain network stacks, may misbehave when placed in UMBs. Keep critical drivers in conventional memory if you observe instability.
DOS=HIGH,UMB must appear after the EMM386 line; otherwise DOS will not relocate its kernel and buffers, and you will see no benefit from the UMA.
Concrete Example
Assume a system with the following configuration:
DEVICE=C:\DOS\HIMEM.SYS /TESTMEM:OFF
DEVICE=C:\DOS\EMM386.EXE RAM I=B000-B7FF X=B800-BFFF DOS=UMB
Here the I= range reserves video ROM, and the X= range excludes the SCSI BIOS area (B800‑BFFF) that is often used by host adapters. After rebooting and adding:
DEVICEHIGH=C:\DOS\ANSI.SYS
LH C:\DOS\SMARTDRV.EXE
the MEM /C /P output shows 620 KB free in conventional memory, and the 600 KB game loads successfully.
Conclusion
Configuring Upper Memory Blocks with EMM386.EXE is a proven way to reclaim conventional memory on MS-DOS 5.0–6.22 systems that run on 386 or newer CPUs. By loading HIMEM.SYS first, reserving the correct UMA segments, and using DEVICEHIGH/LOADHIGH for drivers, you can typically increase free conventional memory by 100 KB to 200 KB, enough for larger applications. Verify with MEM /C /P, test your target program, and keep recovery steps (F5/F8) handy in case of boot issues.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.