Atari 8-Bit Keyboard Hardware

Year
1979
Type
Component
Category
Technical reference — keyboard matrix, POKEY scanning, console keys and RESET
Manufacturer
Atari, Inc. / Atari Corp.
Grey Atari XE System Keyboard, a separate keyboard unit for the XE Game System

Overview

The 8-bit Atari has no keyboard controller chip. Instead, the keyboard is a plain switch matrix that POKEY scans by itself, in hardware, while the CPU gets on with other work. A few special keys bypass the matrix entirely: SHIFT, CONTROL and BREAK have their own lines into POKEY, the console keys START, SELECT and OPTION are read through GTIA, and SYSTEM RESET is wired to the reset or interrupt circuitry. Knowing this explains several Atari quirks — why BREAK can be disabled but RESET cannot, why two-key combinations sometimes misbehave, and how the XE Game System can detect whether its keyboard is plugged in.

The scanned matrix

POKEY counts through 64 possible key positions, checking one at each tick of its 15 kHz clock, so a full scan takes about 4 ms. When it finds a pressed key it confirms it on the next pass (debounce), then:

  • puts the 6-bit scan code into KBCODE ($D209), with bit 6 showing SHIFT and bit 7 showing CONTROL at that moment;
  • raises the keyboard interrupt (IRQ bit 6), which the OS uses to read the key;
  • holds SKSTAT bit 2 low for as long as the key stays down, which the OS uses for auto-repeat.

Scan codes are neither ATASCII nor screen codes; the OS translates them through a table. Releasing a key never changes KBCODE, and pressing the same key twice gives the same code, so software counts presses through the interrupt or by polling SKSTAT. Six codes in the matrix are not wired to any key, and the codes for F1–F4 exist only on the 1200XL, the one model with function keys. With debounce switched off (SKCTL = $02) even the unwired codes can be produced by fast multi-key presses.

SHIFT, CONTROL and BREAK are sensed in parallel with the matrix. SHIFT's state is visible at any time in SKSTAT bit 3; BREAK generates its own interrupt (IRQ bit 7) on key-down only, and cannot be detected while keyboard scanning is disabled. That separate interrupt is why programs can disable BREAK by masking it, while other keys still work.

The console keys

START, SELECT and OPTION are not on the matrix at all. They connect to three of GTIA's four general-purpose I/O lines and appear as bits 0–2 of CONSOL ($D01F), reading 0 when pressed; the fourth line, bit 3, drives the 400/800's internal speaker (the keyclick and buzzer). Because the OS checks them at power-up, they double as boot options on XL/XE machines: OPTION disables BASIC (or runs Self Test), START requests a cassette boot.

RESET: two different designs

  • 400/800: SYSTEM RESET is wired to ANTIC's RNMI input, so pressing it produces a non-maskable interrupt that the OS turns into a warm start. It does not reset the 6502, so a program that has crashed the CPU or disabled interrupts can leave RESET dead — then only power-cycling helps.
  • 1200XL and later: RESET pulls the real reset lines of the 6502, ANTIC, FREDDIE and the PIA. Memory banking returns to default and the CPU restarts at the reset vector; the OS then decides whether to warm-start. ANTIC's RNMI line is tied high on these models.

Keyboards by model

Model Keyboard
400 Flat membrane — the only 8-bit Atari without a full-stroke keyboard. On both 400 and 800, SYSTEM RESET, OPTION, SELECT and START sit in a column to the right of the keyboard
800 Full-stroke; four documented keyboard types
1200XL Eleven keys along the top: RESET, START, SELECT, OPTION, F1–F4, HELP, Reverse (the 400/800's Atari-logo key) and BREAK; redefinable key map; CONTROL+F1 locks the keyboard, CONTROL+F3 toggles keyclick
600XL/800XL Five keys in a column to the right: RESET, OPTION, SELECT, START and HELP; no F-keys; at least five documented keyboard variants
65XE/130XE/800XE Redesigned keyboard; HELP, START, SELECT, OPTION and RESET along the top
XE Game System Detachable XE System Keyboard

On every XL and XE, HELP is a normal matrix key (scan code $11), and the keyclick is mixed into the TV sound rather than a separate speaker.

The detachable XEGS keyboard

The XE Game System console has a DA-15 keyboard port carrying POKEY's six scan lines (K0–K5) and two response lines (KR1, KR2), +5 V and ground — the same signals that run inside every other model. One pin, KBDETECT, goes to GTIA's trigger 2 input: with a keyboard connected TRIG2 reads 1, without it 0. The console's ROM uses this to decide at power-up between starting Missile Command and behaving like a 65XE computer.

Tips

  • A stuck key blocks the rest. Once POKEY has confirmed a key it waits for that key's release before reporting any other, so one shorted key can make the whole keyboard seem dead.
  • Two keys at once: games that read KBCODE see only the most recent key; read SKSTAT and CONSOL for held keys and console buttons.
  • XEGS: to get to the computer side of the console, connect the keyboard before switching on.

Credits