How EMM386.EXE Allocates UMBs in MS-DOS 6.22

In MS-DOS 6.22, maximizing conventional memory requires utilizing the Upper Memory Area (UMA)—the 384 KB address space located between 640 KB and 1024 KB. By default, this region is reserved for system ROMs, video memory, and hardware expansion cards. Through EMM386.EXE, an expanded memory manager working in tandem with the extended memory manager HIMEM.SYS, MS-DOS identifies unused gaps within this address space and maps physical extended memory (XMS) into them. This process creates Upper Memory Blocks (UMBs), allowing device drivers and terminate-and-stay-resident (TSR) programs to load outside the critical 640 KB conventional memory footprint.

The Prerequisites for UMB Allocation

Before EMM386.EXE can allocate UMBs, the system must establish access to extended memory and instruct the operating system to link the upper memory structure. This requires two preliminary directives in CONFIG.SYS:

DEVICE=C:\DOS\HIMEM.SYS
DOS=HIGH,UMB

HIMEM.SYS enables access to memory above 1 MB and manages the High Memory Area (HMA). The DOS=UMB switch instructs MS-DOS to maintain an internal link between conventional memory and the upper memory arena managed by EMM386.EXE.

The Role of EMM386.EXE and Virtual 8086 Mode

EMM386.EXE relies on the paging hardware of the Intel 80386 processor (and newer). When loaded, it places the CPU into Virtual 8086 mode. In this mode, the processor can map 4 KB physical pages from extended memory into arbitrary addresses in the real-mode address space.

During initialization, EMM386.EXE scans the range C000h to FFFFh in 4 KB increments to identify regions not currently occupied by video adapters, BIOS routines, or network adapters. Once free spaces are identified, EMM386.EXE establishes page tables that map blocks of extended memory into these physical holes, creating UMBs.

Essential EMM386 Configuration Parameters

The allocation behavior, size, and layout of UMBs are controlled entirely by parameters appended to EMM386.EXE in CONFIG.SYS.

The Operating Modes: NOEMS vs. RAM

To enable UMB allocation, you must specify either the NOEMS or RAM switch:

  • NOEMS: This parameter tells EMM386.EXE to provide UMBs without providing Expanded Memory Specification (EMS) memory. Because it does not provide EMS, it avoids reserving a 64 KB contiguous block for an EMS page frame. This leaves the maximum possible contiguous space available for UMB allocation.
    DEVICE=C:\DOS\EMM386.EXE NOEMS
  • RAM: This switch enables both UMB support and EMS 4.0 support. EMM386.EXE allocates a 64 KB page frame (typically at segment E000h or D000h) for expanded memory and uses any remaining free UMA space for UMBs.
    DEVICE=C:\DOS\EMM386.EXE RAM

Memory Range Inclusions and Exclusions

Because hardware detection can occasionally misidentify active ROMs or miss usable regions, manual allocation controls are available:

  • I=range (Include): Forces EMM386.EXE to treat a specified address range as free upper memory. For instance, monochrome display adapters leave address ranges B000h–B7FFh unused. Systems that do not use a PS/2 BIOS extension can often reclaim the E000h–EFFFh region:
    DEVICE=C:\DOS\EMM386.EXE NOEMS I=B000-B7FF I=E000-EFFF
  • X=range (Exclude): Prevents EMM386.EXE from mapping over an address range, even if the automatic scan believes the range is empty. This is necessary for network interface cards (NICs), SCSI controllers, or memory-mapped I/O devices that do not expose ROM headers:
    DEVICE=C:\DOS\EMM386.EXE NOEMS X=C800-CFFF

Advanced Allocation Flags

  • HIGHSCAN: Instructs EMM386.EXE to use an aggressive scanning algorithm for the upper memory area to locate usable spaces that standard scanning might mark as reserved.
  • FRAME=address: When running with the RAM parameter, this defines the exact base address for the 64 KB page frame (e.g., FRAME=D000).
  • D=nnn: Specifies the amount of memory (in kilobytes) reserved for Direct Memory Access (DMA) transfer buffers. The default is typically 16 KB, but sound cards and SCSI devices might require larger buffers (e.g., D=64).
  • VERBOSE (or V): Forces EMM386.EXE to display memory mappings, allocated UMBs, and page frame locations during system boot.

How MS-DOS Allocates Programs into UMBs

Once EMM386.EXE defines the UMBs, it hands their control over to the MS-DOS memory management chain. The DOS kernel treats these blocks as non-contiguous extensions of conventional memory, constructing Memory Control Blocks (MCBs) for each designated upper block.

Software is loaded into these regions using specific commands:

  • DEVICEHIGH: Used in CONFIG.SYS to load drivers into UMBs.
    DEVICEHIGH=C:\DOS\SETVER.EXE
  • LOADHIGH (or LH): Used in AUTOEXEC.BAT or from the command line to load TSRs into UMBs.
    LH C:\DOS\DOSKEY.COM

MS-DOS 6.22 can further manage these allocations through region targeting. By using the syntax DEVICEHIGH /L:region1,minsize;region2, administrators specify the exact UMB segment a program must enter, preventing larger drivers from fragmenting the upper memory blocks needed by other utilities. Memory allocation and UMB status can be verified at any time using the MEM /C or MEM /M commands from the DOS prompt.