Using EMM386.EXE to Load Drivers into Upper Memory Blocks on MS-DOS
Learn how to free conventional memory on MS‑DOS by loading device drivers into Upper Memory Blocks with EMM386.EXE and HIMEM.SYS.
14 Jul 2026, 13:42 UTC

Problem: Conventional Memory Exhaustion
On MS-DOS systems the first 640KB of RAM (conventional memory) holds the command interpreter, TSRs, device drivers and application code. When several drivers and memory‑resident programs are loaded, the free conventional memory can drop below the 60KB threshold required by many DOS utilities, causing "Out of memory" errors even though extended memory is available.
Requirements
- Free as much conventional memory as possible for applications.
- Keep essential drivers (e.g., disk, mouse, network) loaded at boot time.
- Use only software that ships with MS‑DOS 5.0+ or a compatible third‑party package.
- Maintain system stability on a wide range of 80386‑compatible hardware.
Smallest Suitable Design
The design adds two lines to the system’s CONFIG.SYS file:
- Load the extended memory manager
HIMEM.SYSto enable the XMS API. - Load
EMM386.EXEwith theRAMandI=B000-B7FFswitches, which creates Upper Memory Blocks (UMBs) in the 640KB‑1MB region and allows drivers to be placed there via theDEVICEHIGHdirective.
All other drivers that can run in upper memory are changed from DEVICE= to DEVICEHIGH=. No additional hardware is required.
Trust/Data Boundaries
The boundary of trust lies between the conventional memory region (where DOS and applications execute) and the UMB region (managed by EMM386.EXE in virtual‑8086 mode). Drivers loaded into UMBs run with the same privilege level as conventional code but are isolated by the CPU’s paging mechanism; they cannot directly access hardware registers without going through BIOS interrupts, preserving the original trust model.
Operational Checks
- After editing
CONFIG.SYS, reboot the machine. - At the
C:\>prompt runMEM /C. The output shows sections labelled "Upper memory blocks" and the amount of free UMB space. - Verify that each driver intended for upper memory reports "Loaded high" when you run
MEM /Por check the boot messages. - Launch a memory‑hungry application (e.g., a large spreadsheet or a game) and confirm it starts without the "Out of memory" error.
Failure Modes
- Video ROM shadowing conflict: On some systems the
I=B000-B7FFrange overlaps the video BIOS ROM, causingEMM386.EXEto hang or produce garbled display. The remedy is to exclude that range withI=B000-B7FFremoved or to useI=C000-C7FFif the hardware permits. - Insufficient UMBs: If the total size of drivers loaded high exceeds the available UMB space,
EMM386.EXEwill refuse to load additional drivers high, leaving them in conventional memory and defeating the purpose. - CPU requirement:
EMM386.EXEneeds an 80386 or later; on an 80286 the driver will fail to install, leaving the system with only conventional and extended memory. - Driver incompatibility: A few legacy drivers rely on being executed from low memory and will crash when relocated high. Such drivers must remain
DEVICE=.
When the Design Must Change
If the target machine lacks an 80386‑compatible CPU, the design falls back to using only HIMEM.SYS for extended memory and accepting the conventional memory limit. If video ROM shadowing makes the standard I=B000-B7FF exclusion ineffective, the designer must experiment with other exclusion ranges (e.g., I=C000-C7FF) or disable UMBs entirely and rely on DOS extenders for applications that need more than 640KB.
Should a new driver be identified as incompatible with high memory, revert its line to DEVICE= and re‑run MEM /C to confirm that the driver now resides in conventional memory while the rest of the configuration remains unchanged.
Example Configuration
DEVICE=C:\DOS\HIMEM.SYS DEVICE=C:\DOS\EMM386.EXE RAM I=B000-B7FF DEVICEHIGH=C:\DOS\ANSI.SYS DEVICEHIGH=C:\DOS\SETVER.EXE DEVICEHIGH=C:\DOS\SMARTDRV.EXE /DOUBLE_BUFFER
After a boot, MEM /C might report something like:
Total conventional memory: 640 KB Free conventional memory: 420 KB Total upper memory: 128 KB Free upper memory: 96 KB Total extended memory: 15360 KB Free extended memory: 14800 KB
The exact numbers will vary with hardware and driver set.
Rollback
Because the change only adds lines to CONFIG.SYS, rolling back consists of removing or commenting those lines (prefix with REM) and rebooting. No data on disk is altered.
Practical Verification
To confirm that the design works as intended:
- Boot the system with the modified
CONFIG.SYS. - Run
MEM /Cand note the free conventional memory value. - Load a known‑sized TSR (e.g.,
DOSKEY) high withLOADHIGH DOSKEYand runMEM /Cagain; the free conventional memory should increase by roughly the size of the TSR. - If the free conventional memory does not increase as expected, check the boot screen for messages from
EMM386.EXEabout UMB allocation.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.