How MS-DOS 6.22 Uses the High Memory Area
This article explains how MS-DOS 6.22 accesses and utilizes the High
Memory Area (HMA)—the first 64 KB block of extended memory located
directly above the 1 MB boundary. By leveraging the
HIMEM.SYS driver and the DOS=HIGH
configuration directive, the operating system relocates substantial
portions of its core kernel out of the critical 640 KB conventional
memory space, maximizing the available RAM for demanding DOS
applications and games.
The Mechanics of the High Memory Area
In the original Intel 8086 processor, memory addressing was limited
to 1 MB (\(100000\) in hexadecimal) due
to its 20-bit address bus. Memory was accessed using a 16-bit segment
and a 16-bit offset. When using the maximum segment address
FFFFh with offsets greater than 000Fh, the
calculated physical address exceeds 1 MB. On an 8086, this address
wrapped around to the beginning of memory (\(00000\)h).
Starting with the Intel 80286, processors featured address buses
wider than 20 bits. Instead of wrapping around, addresses from
FFFF:0010 to FFFF:FFFF accessed physical
memory from 100000h to 10FFEFh. This region
comprises exactly 65,520 bytes (almost 64 KB) of extended memory
accessible while the processor remains in real mode. This specific
segment is called the High Memory Area.
Enabling the HMA via the A20 Gate
Because older software depended on the 1 MB wraparound behavior, PC motherboards introduced the "Gate A20" hardware switch to control the 21st address line. By default, the A20 gate is disabled to maintain 8086 compatibility.
MS-DOS 6.22 enables the HMA through its extended memory manager,
HIMEM.SYS. When loaded in CONFIG.SYS,
HIMEM.SYS handles communication with the motherboard
chipset or keyboard controller to enable the A20 gate, allowing the CPU
to address the HMA in real mode.
Relocating the DOS Kernel with DOS=HIGH
By default, MS-DOS 6.22 loads its kernel into conventional memory
(the first 640 KB). To utilize the HMA, the user must add the following
lines to CONFIG.SYS:
DEVICE=C:\DOS\HIMEM.SYS
DOS=HIGH
When initialized with DOS=HIGH, MS-DOS 6.22 moves the
resident portions of the DOS operating system code, internal variables,
and data buffers into the HMA. This process frees approximately 45 KB to
60 KB of conventional memory, commonly bringing available base RAM well
above 600 KB for user applications.
Operational Constraints
The architecture of the HMA imposes specific limitations in MS-DOS 6.22:
- Exclusive Ownership: The HMA cannot be dynamically shared like conventional memory. Only one program or operating system component can reside in the HMA at a time.
- Kernel Dominance: When
DOS=HIGHis specified, the MS-DOS kernel takes ownership of the HMA, effectively preventing third-party TSRs (Terminate-and-Stay-Resident programs) or device drivers from using it, although drivers can still be loaded into Upper Memory Blocks (UMBs) viaDEVICEHIGHandLOADHIGH.