Free Conventional Memory in MS-DOS with EMM386 and Upper Memory Blocks
Use EMM386.EXE on 80386+ hardware to create Upper Memory Blocks, move DOS and drivers out of the 640 KB conventional limit, and free memory for DOS applications.
09 Jul 2025, 14:25 UTC

Problem: conventional memory runs out under DOS
MS-DOS applications run in the first 640 KB of address space, the Conventional Memory limit imposed by the 8086 20-bit address bus. Device drivers and Terminate and Stay Resident programs, TSRs, load into that same area and reduce the bytes available to applications. The practical engineering decision is to move DOS and drivers out of Conventional Memory into Upper Memory Blocks, UMBs, in the 640 KB to 1 MB Upper Memory Area, UMA, using EMM386.EXE.
EMM386 uses the 80386 Virtual 8086 mode to map Extended Memory above 1 MB into the Lower Memory Area, LMA, and to provide Expanded Memory Specification, EMS, page-frame switching for legacy programs. The result is more free Conventional Memory without changing hardware.
Desired outcome
Load DOS kernel into High Memory Area and relocate device drivers and TSRs into UMBs, leaving the maximum possible Conventional Memory free for applications. Optionally enable EMS page-frame support for applications that require it.
Prerequisites
- Intel 80386 or compatible CPU. EMM386 will not run on 8086 or 80286 hardware.
- MS-DOS 5.0 or later with EMM386.EXE present, typically in C:\DOS.
- Write access to CONFIG.SYS and AUTOEXEC.BAT on the boot drive. Changes require a reboot.
- Backup of CONFIG.SYS and AUTOEXEC.BAT before editing.
Focused procedure
Edit CONFIG.SYS from a DOS prompt with a text editor. The file is read at boot.
- Enable High Memory and UMB support. Add or ensure the line:
DOS=HIGH moves the DOS kernel into the High Memory Area above 1 MB. UMB enables Upper Memory Blocks.DOS=HIGH,UMB - Load the memory manager. Add a DEVICE line for EMM386. A minimal safe form is:
NOEMS provides UMBs without allocating an EMS page frame. Use RAM to also provide EMS, or FRAME to specify a page frame address. Example with explicit frame:DEVICE=C:\DOS\EMM386.EXE NOEMS
The FRAME parameter reserves a 64 KB window in the UMA for EMS page switching. Use the EXCLUDE switch to avoid hardware-mapped regions, for example network or SCSI cards.DEVICE=C:\DOS\EMM386.EXE RAM FRAME=E000 - Load drivers into UMBs. In CONFIG.SYS use DEVICEHIGH instead of DEVICE for drivers that support relocation, and in AUTOEXEC.BAT use LH instead of direct loading for TSRs. Example:
DEVICEHIGH=C:\DOS\HIMEM.SYSDEVICEHIGH=C:\DOS\ANSI.SYS - Save the files and reboot. The system must restart for CONFIG.SYS changes to take effect.
Expected checks
After reboot, run MEM from a DOS prompt to inspect memory usage.
- Check that Conventional Memory free is increased compared to before the change.
- Verify Upper Memory Blocks are present and used. MEM reports total memory, largest executable program size, and a summary of Upper Memory usage.
- Confirm CONFIG.SYS contains DEVICE=C:\DOS\EMM386.EXE and DOS=HIGH,UMB. Absence indicates the file was not read or edited correctly.
- For EMS, run a diagnostic utility that reports EMS availability if RAM was specified. The page frame address should match the FRAME setting.
Limitations and recovery
EMM386 maps memory above 1 MB into the LMA. Loading too many drivers into UMBs can cause instability or conflicts with hardware-mapped addresses in the UMA. If a conflict occurs, add EXCLUDE ranges to EMM386, for example EXCLUDE=E000-EFFF, to keep those addresses unused.
Not all drivers can be loaded high. Some require real-mode access to specific ports and will fail under DEVICEHIGH. Test incrementally.
Recovery options. If the system fails to boot, start with a minimal CONFIG.SYS. From the boot menu or by editing CONFIG.SYS at the DOS prompt, comment out the EMM386 line and DEVICEHIGH lines with a semicolon ; and reboot. Restore the backed up CONFIG.SYS if needed. Removing EMM386 returns the system to standard 640 KB Conventional Memory operation.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.