However, it was quickly discovered that an addressing peculiarity in the 20 bit addressing could make a small area of the extended memory (XMS) above 1MByte available to normal MSDOS programs. This came about because the 20 bit addresses were generated by adding a sixteen bit register to another 16 bit register that was first multiplied by 16. If the second register was loaded with FFFF, the addition could generate addresses as high as (FFFF*10)+FFFF = FFFF0+FFFF = 10FFEF.
This operation was of no value on pre-80286 CPUs because there was no external address line to put the leading 1 bit on. However on the 80286 there was a 21st address line. The 21st line was called "A20" because the address lines counted from 0. The 80286 and all later compatible CPUs make it optional whether the A20 line is set when a 20 bit address generation creates a 1 bit there. The (almost) 64K space accessible by putting the generated one bit onto A20 is called the High Memory Area (HMA).
The importance of A20 addressing is that it does not require that the code being run in HMA do anything special when operating in the HMA. Thus, "real mode" OSes like MSDOS can gain 6% more memory at very minimal cost.
A20 handling is controlled by the eXtended Memory Handler which has to know not to allocate the space for other uses. In MSDOS, the XMS handler is HIMEM.SYS. Traditionally, the HMA is used by operating system code, not user code and is loaded by specifying DOS=HIGH in the CONFIG.SYS file. A20 usage requires support from the motherboard chipset and is plauged with timing issues on some motherboards. HIMEM .SYS and similar XMS managers have a number of optional settings that can be used to try to get individual PCs to handle A20 addressing properly. A few old PCs simply can not use the HMA even though the CPU and memory should be able to allow its use. In addition to HIMEM.SYS, other A20 handlers that might be encounterd include QEMM, 386MAX and VDISK. Freedos A20 handling is provided by FDXMS.SYS.
The A20 controller itself is traditionally located on the keyboard unit. This appears to be a matter of board layout concerns in the distant past. It does not mean that the A20 line has anything to do with key handling.
The addressing trick came about because the 8088 CPU used in the original IBM PC addresses 1 megabyte of memory using 16 bit registers that can only address 64Kbytes. The additional four bits required to address out to 1MB come from separate registers that are manipulated independently of the 16 low bits. However, the "segment" registers providing the extra 4 bits are 16 bits, not just 4 bits. And the 16 bits are arithmetically added to the 16 bit address, not just ORed. So, the range of addresses that can actually be generated in the 8088 is 00000-1FFFF0 rather 00000-FFFFF. This was irrelevant in the 8086/8088 which did not bring that extra one bit off the CPU to a pin that could be used for addressing. But in the 80286 and later which could address more than 1MB of memory in some modes, that additional line called A20 was brought out and connected. So the 80286 and above ended up with two addressing modes. One emulated the the 8086/8088 and did not put a 1 on the A20 line if address computation generated a 1. The other mode put a 1 there.
The result of this is that 286 and above CPUs can be configured to allow 64K of memory between addresses 10000 and 10FFF to be addressed while executing code intended for a simple, real-mode, environment. All that was required was an "A20" handler that turned access to the 64K and some method of loading code there. In MSDOS, the A20 handling is provided by HIMEM.SYS and the capability to load code into the 64K "HIGH" memory area is provided by MSDOS which will load large portions of its own code there if the command MSDOS=HIGH appears in CONFIG.SYS. MSDOS does not support HIGH memory on 8088, 8086, or 80186 type CPUs that lack a physical A20 address line. In addition, a few old BIOSes or motherboards don't support A20 properly even on CPUs that should, in principle, support it. Other A20 handlers include QEMM, 386MAX and VDISK. Freedos A20 handling is provided by FDXMS.SYS.
Return To Index Copyright 1994-2008 by Donald Kenney.