D 2017-09-05T04:05:45.557 L KIA N text/x-markdown U kc5tja W 1263 # Keyboard Interface Adapter (KIA) The KIA provides a dedicated PS/2 input controller. It provides a 16-deep FIFO (of which up to 15 bytes can be queued at any given time). ## Register Map |Byte Offset|Name|R/W|Purpose| |:---------:|:--:|:-:|:------| |0|STAT|R|8-bit status register| |2|DATA|R|8-bit data input port| |2|POP |W|Strobe to pop the FIFO.| **NOTE.** Attempting to access the KIA registers with 16-bit or wider accesses will yield unpredictable results. **Always use 8-bit loads** when accessing the KIA core. ## `STAT` Register |Bit|Name|Purpose| |:-:|:--:|:------| |`7-2`||*unassigned*| |`1`|`QF`|0 if the KIA input queue is not yet full; 1 if no further data can be accepted.| |`0`|`QE`|0 if the KIA input queue is not empty; 1 if the queue is empty.| ## `DATA` Register |Bit|Name|Purpose| |:-:|:--:|:------| |`7-0`|`DATA`|The head of the PS/2 scancode FIFO.| **NOTE**. Multiple reads of this port will return *the same byte value*. Once a keyboard driver reads a byte from the FIFO, it *must* "pop the queue" by writing a value to `POP`. ## `POP` Strobe This write-only register ignores all 8 bits written to it. Its sole purpose is to pop the FIFO, thus revealing the next available byte, if any. Z 9220c321670a906534886a8f2ce7b3a2