AKI — PC Keyboard Interface
- Year
- 1998
- Type
- DIY project
- Category
- Keyboard interface
- Manufacturer
- Homebrew design by A. Bertram (Germany)
- Tags
- keyboard, pc-keyboard, pokey, pic, key-matrix, diy, xl, xe, germany, aki
Overview
Atari keyboards wear out, and many people would rather type on a full-size PC keyboard. AKI (Atari Keyboard Interface) does exactly that. A small board with a PIC microcontroller sits on the keyboard lines inside an XL/XE and pretends to be a key matrix. The PC keyboard sends scancodes to the PIC, and the PIC answers the Atari's own keyboard scanning as if the matching Atari key were held down. Because it works at the hardware level, every program and OS sees an ordinary Atari keyboard, so no driver is needed.
The design documentation, written in German by A. Bertram and dated 26 April 1998, explains in unusual depth how the Atari keyboard works. AKI became popular enough that Paweł "Pajero" Nowak's 2009 uCovox digital-sound board was designed as an add-on for it, and Lotharek sells that add-on.
How the Atari keyboard works (and what AKI imitates)
- START, SELECT and OPTION are plain TTL inputs to GTIA, pulled low when pressed and readable at any time. RESET on an XL acts directly on the CPU. On XE machines it only triggers a 555 timer that produces a short reset pulse, so you can't hold the CPU in reset by keeping the key down.
- All other keys, including HELP, form a 64-key matrix (Matrix 1) scanned by POKEY. POKEY counts through all 64 positions, about 32 µs per step. It uses three bits to select a row and three to select a column. When the key at the current position is down, a pulse comes back on the return line and POKEY latches that matrix code into
KBCODE($D209, bits 0–5). If several keys are down, the last one in the scan wins. - SHIFT, CONTROL and BREAK have to work together with other keys, so they sit on a second matrix (Matrix 2) read through the same counter. They show up as bit 6 (SHIFT) and bit 7 (CTRL) of
KBCODEand inSKSTAT($D20F). BREAK raises an interrupt viaIRQST($D20E). - Key repeat is handled by the OS: the delay is in
$02D9and the rate in$02DA, both counted in VBIs.
Bertram's matrix-code table lists every key position (for example $3F = A, $0C = RETURN, $1C = ESC, $27 = Inverse, $11 = HELP). Note that the hardware counter runs backwards, so the count must be inverted when mapping positions.
How AKI does it
The PIC has to reply within the 32 µs window for each scan step. Bertram measured his code's response at 10–25 µs: fast enough, though it varies when a PC-keyboard byte arrives at the same moment. To save wires, AKI watches only the lowest and highest bits of POKEY's scan counter and reconstructs the rest itself. A full two-matrix emulation therefore needs just four lines: two counter outputs from POKEY and the two matrix return inputs. Four more lines drive START, SELECT, OPTION and RESET.
There is a bonus output: a RAM-disk switch pin that F8 or SHIFT+F8 sets or clears while the machine is held in reset. That lets you flip between two memory configurations ("both computers") without crashing.
Building and fitting
- Program the PIC with the published firmware and build the small board.
- Connect it inside the computer to POKEY's keyboard-scan and return lines, to the console-key lines of GTIA, and to the reset line, as given in the AKI documentation.
- Use a PC keyboard of the type the PIC firmware expects.
Why it's useful
- A full-size, cheap, replaceable keyboard for word processing and programming.
- A fix for machines whose membrane or keyboard connector has failed.
- A handy basis for other add-ons, as the uCovox audio board shows.
Bertram's write-up is also one of the clearest explanations of POKEY's keyboard scan, and well worth reading if you plan your own keyboard hardware.
Credits
- Picture: Lotharek's AKI USB board, a later USB-keyboard version of the AKI interface. — AKI USB keyboard interface board, product photo from Lotharek's shop (Product photo used for identification/commentary)
- A. Bertram — ATARI-Tastaturcodes (Matrixcodes) / AKI documentation, 26.04.1998 (German), Nir Dary collection — A. Bertram, 1998
- comp.sys.atari.8bit FAQ, section 6.11 (uCovox add-on for AKI by Lotharek) (Michael Current, Feb 2026) — Michael Current (comp.sys.atari.8bit FAQ), 2026
