For 80286, 80386, and 80486 computers, the CPU's 21st address line (A20 line) controls access to the extra 64K of address space called the high memory area (HMA). Computer manufacturers often include a circuit to disable the A20 line when the CPU runs in real mode. This ensures that the operating environment is identical to the 8086 environment, in which addresses such as FFFF:0010 wrap back to the beginning of memory. When the A20 line is enabled, however, addresses that would otherwise wrap (that is, addresses in the range FFFF:0010 through FFFF:FFFF) provide access to the HMA.
If a computer provides RAM for the HMA, MS-DOS can enable the A20 line and relocate system code to the HMA, thereby freeing conventional memory for other programs. MS-DOS relocates to the HMA only if the dos=high command is in the CONFIG.SYS file and the HIMEM.SYS driver is loaded. This driver provides the code required to enable and disable the A20 line.
To support programs that expect addresses to wrap, MS-DOS disables the A20 line whenever it loads and runs a program. While the A20 line is disabled, MS-DOS in the HMA is not directly accessible, although programs can still call MS-DOS system functions. To accomplish this, MS-DOS redirects all system calls to a “stub” in conventional memory that enables the A20 line and jumps to the requested MS-DOS system function. Once enabled by the stub, the A20 line remains enabled even after the system function returns to the program.
Programs must not use the HMA if MS-DOS has been relocated there. A program can determine whether MS-DOS is in the HMA by using Get MS-DOS Version (Interrupt 21h Function 3306h). This function sets bit 4 in the DH register to 1 if MS-DOS is in the HMA.