What Does HIMEM.SYS Do in MS-DOS 6.22?

In MS-DOS 6.22, the primary function of the HIMEM.SYS device driver is to manage extended memory (RAM beyond the standard 1 megabyte limit) in accordance with the Extended Memory Specification (XMS). By loading HIMEM.SYS, the operating system can safely coordinate access to extended memory, control the A20 address line, and unlock the High Memory Area (HMA). This process prevents software conflicts and frees up vital conventional memory for DOS applications.

Extended Memory Management (XMS)

By default, the real-mode architecture of MS-DOS is constrained to 1 megabyte (MB) of addressable memory, with only the first 640 kilobytes (KB) designated as conventional memory for running programs. HIMEM.SYS acts as the standardized supervisory layer that enables 80286, 80386, and later processors to access memory above the 1 MB barrier. It implements the XMS standard, allowing software to request, allocate, and release blocks of extended memory without conflicting with other running applications.

Controlling the A20 Line

To access physical RAM beyond 1 MB, the processor requires access to the 21st address line, known as the A20 line. In early PC architectures, this line was intentionally disabled by default to maintain backward compatibility with the Intel 8086 processor's memory-wrapping behavior. HIMEM.SYS tests the hardware and engages the correct method to enable and switch the A20 line on demand, serving as the hardware bridge to high-address memory.

Enabling the High Memory Area (HMA)

HIMEM.SYS manages the High Memory Area (HMA), which is the first 64 KB segment of extended memory located immediately above the 1 MB mark (between 1024 KB and 1088 KB). Under MS-DOS 6.22, this is particularly critical:

  • It allows the DOS kernel itself to be loaded into the HMA via the DOS=HIGH command in CONFIG.SYS.
  • Moving core DOS routines out of the lower 640 KB preserves maximum conventional memory for memory-intensive games and productivity software.

Prerequisite for Expanded Memory and Upper Memory Blocks

HIMEM.SYS is a mandatory prerequisite for other advanced memory managers in MS-DOS 6.22, such as EMM386.EXE. Before EMM386 can map extended memory into Upper Memory Blocks (UMBs) or emulate expanded memory (EMS), HIMEM.SYS must first be initialized to provide stable access to the underlying extended memory pool.

Standard Configuration

HIMEM.SYS is typically loaded as the very first driver in the CONFIG.SYS file with the following syntax:

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

Without HIMEM.SYS loaded at boot, MS-DOS 6.22 operates strictly within base memory limits, leaving any additional RAM installed in the computer unreachable.