Fix HIMEM.SYS Unable to Control A20 Line Error

When MS-DOS 6.22 boots and the extended memory manager HIMEM.SYS cannot initialize or detect the A20 address line, it halts driver installation with a specific startup error. This article explains the exact error message produced during boot, why the failure occurs, and how to resolve the issue using the appropriate configuration parameters in your CONFIG.SYS file.

The Error Message

If HIMEM.SYS cannot toggle or detect the A20 gate, it halts initialization and outputs the following error sequence to the screen:

ERROR: Unable to control A20 line!
XMS Driver not installed.

Because the driver fails to load, MS-DOS cannot provide Extended Memory Specification (XMS) services to applications, and the High Memory Area (HMA)—the first 64 KB of extended memory—becomes completely unavailable.

Why the Error Occurs

The A20 line is the 21st address line on x86 processors, originally tied to the keyboard controller on the IBM PC/AT to maintain backward compatibility with 8086 real-mode 1 MB memory wrapping. HIMEM.SYS requires control over this line to switch it on, allowing the system to address memory beyond 1,024 KB.

The ERROR: Unable to control A20 line! message occurs when:

  • The default A20 switching method used by HIMEM.SYS is incompatible with your system's motherboard chipset or BIOS.
  • The system is running inside a modern hypervisor or virtual machine (such as VirtualBox, VMware, or DOSBox) with non-standard A20 handling emulation.
  • There is a hardware fault in the keyboard controller or chipset logic responsible for gating the A20 line.

How to Fix the Error

To resolve the error, explicitly specify the A20 switching method using the /MACHINE: switch (or its shorthand, /M:) in the CONFIG.SYS file.

  1. Open CONFIG.SYS in a text editor (such as MS-DOS EDIT).
  2. Locate the line loading HIMEM.SYS:
    DEVICE=C:\DOS\HIMEM.SYS
  3. Append the /MACHINE: parameter with the code that matches your hardware:
    DEVICE=C:\DOS\HIMEM.SYS /MACHINE:1

Common machine codes for MS-DOS 6.22 include:

Code / Number Alternative Name Hardware Type
1 at IBM PC/AT or 100% compatible
2 ps2 IBM PS/2
3 ptlcascade Phoenix Cascade BIOS
4 hpvectra HP "Classic" Vectra (A and A+)
5 att6300plus AT&T 6300 Plus
6 acer1100 Acer 1100
7 toshiba Toshiba 1600 & 1200XE
8 wyse Wyse 12.5 MHz 286

For modern virtual machines and most generic PC clones, setting /MACHINE:1 (IBM PC/AT standard) or /MACHINE:13 (PC/AT alternative delay) typically resolves the detection failure and allows HIMEM.SYS to load properly.