KBC Output Port

Keyboard Controller Output Port

The Intel 8042 or equivalent keyboard controller which is directly accessible via ports 0x60 and 0x64 has an eight-bit output port as defined below and an eight-bit input port. As well as outputting serial bit streams to keyboard and mouse it includes bits for A20 control and for hardware reset.

KBC Output Port

Bit 8042 Pin Meaning on AT Systems Meaning on PS/2 Systems
7 P27 Keyboard data output (atr) Keyboard data output
6 P26 Keyboard clock output (atr) Keyboard clock output
5 P25 Input buffer empty signal, NC (atr) IRQ12 output (kadc)
4 P24 Output buffer full signal (atr)
- which was connected to IRQ1
IRQ1 output (kadc)
- essentially the same as on an AT
3 P23 Undefined, NC (atr) Mouse clock output (kadc)
2 P22 Undefined, NC (atr) Mouse data output (kadc)
1 P21 Gate A20 output (atr) Gate A20 output
0 P20 System reset output (atr) System reset output

Note

  • NC means Not Connected. These pins were not connected to anything as shown in (atr) schematic of the system board sheet 17.

The keyboard controller output port is not directly accessible to programs. It is on the 'other' side of the device from the computer's CPU. However, it can be read in its entirety using keyboard controller command 0xD0 and written using command 0xD1.

A20 and Reset

If writing the KBC output port be careful to ensure that the CPU reset bit is set to one. RBIL contains a warning about writing the CPU reset bit. It says that bit 0 (system reset) should always be set to one here; if it is written as zero the system may hang. Use the pulse-output-port command (0xFE) instead. The pulse command will make the bit zero for a short period rather than keeping it in that state.

Sources

Sources for the above are

  • (atr) - IBM Personal Computer AT Technical Reference
  • (kadc) - IBM PS/2 Reference Manual: Keyboard and Auxiliary Device Controller
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License