Atari Keyboard and Driving Controllers (CX50, CX21, CX23, CX20)
- Year
- 1978
- Type
- Peripheral
- Category
- Game controllers — 12-key keypads and rotary driving controllers
- Manufacturer
- Atari, Inc.
Overview
Because the 8-bit Ataris use the same controller ports as the Atari 2600 VCS, the VCS's more unusual controllers work on them too. Two families were marketed for the 400 and 800 in their first years: the CX50 Keyboard Controllers, small 12-key keypads, and the CX20 Driving Controllers, knobs that turn endlessly in either direction. Neither became popular on the computers — the 400 and 800 had a real keyboard and the paddle-like driving controller had little software — but both are well documented in Atari's own technical manuals and still turn up with homebrew software.
The keypads
| Model | Name | Introduced | Notes |
|---|---|---|---|
| CX50 | Keyboard Controllers (pair) | January 1978, for the VCS | Marketed for the 400/800 in 1980–81 |
| CX21 | Video Touch Pad | June 1982, for the 2600 | Packed with the 2600 Star Raiders |
| CX23 | Kid's Controller (also "Action Control Base") | January 1983 | Large and blue; used with Sesame Street titles on the 2600 |
All three share the same key layout and wiring, so software written for one works with the others.
How a keypad works
The twelve keys form a matrix of four rows and three columns. The rows are wired to the four joystick direction lines (PIA outputs), the columns to the port's two paddle (pot) inputs and its trigger:
| Paddle B | Paddle A | Trigger | |
|---|---|---|---|
| Up line | 1 | 2 | 3 |
| Down line | 4 | 5 | 6 |
| Left line | 7 | 8 | 9 |
| Right line | * | 0 | # |
Software turns the PIA port bits into outputs, pulls one row low at a time, and checks which column responds: a pressed key's paddle column reads high (about 228) instead of 1–2, or its trigger reads 0. The OS does none of this for you. Because the keypad grounds the pot lines, POKEY's fast pot-scan mode can read it much faster than the usual once every few frames. As with any diode-less matrix, three keys sharing a row and column produce a "phantom" fourth.
Atari's Operating System User's Manual printed this BASIC routine, which reads keypads on all four ports of a 400/800:
1 GRAPHICS 0
5 PRINT :PRINT " KEYBOARD CONTROLLER DEMO"
10 DIM ROW(3),I$(13),BUTTON$(1)
30 GOSUB 6000
40 FOR CNT=1 TO 4
60 POSITION 2,CNT*2+5:PRINT "CONTROLLER # ";CNT;":";
70 NEXT CNT
80 FOR CNT=1 TO 4:GOSUB 7000:POSITION 19,CNT+CNT+5:PRINT BUTTON$;:NEXT CNT
120 GOTO 80
6000 REM ** SET UP FOR CONTROLLERS **
6010 PORTA=54016:PORTB=54017:PACTL=54018:PBCTL=54019
6020 POKE PACTL,48:POKE PORTA,255:POKE PACTL,52:POKE PORTA,221
6025 POKE PBCTL,48:POKE PORTB,255:POKE PBCTL,52:POKE PORTB,221
6030 ROW(0)=238:ROW(1)=221:ROW(2)=187:ROW(3)=119
6040 I$=" 123456789*0#"
6050 RETURN
7000 REM ** RETURN BUTTON$ WITH CHARACTER FOR BUTTON WHICH HAS BEEN PRESSED ON CONTROLLER CNT (1-4). **
7001 REM ** NOTE: A 1 WILL BE RETURNED IF NO CONTROLLER IS CONNECTED. **
7002 REM ** A SPACE WILL BE RETURNED IF THE CONTROLLER IS CONNECTED BUT NO KEY HAS BEEN PRESSED. **
7003 PORT=PORTA:IF CNT>2 THEN PORT=PORTB
7005 P=1
7008 PAO=CNT+CNT-2
7010 FOR J=0 TO 3
7020 POKE PORT,ROW(J)
7030 FOR I=1 TO 10:NEXT I
7050 IF PADDLE(PAO+1)>10 THEN P=J+J+J+2:GOTO 7090
7060 IF PADDLE(PAO)>10 THEN P=J+J+J+3:GOTO 7090
7070 IF STRIG(CNT-1)=0 THEN P=J+J+J+4:GOTO 7090
7080 NEXT J
7090 BUTTON$=I$(P,P)
7095 RETURN
The routine reconfigures the PIA, so press SYSTEM RESET (or POKE 54018,60) afterwards before doing other I/O. On an XL or XE, which has only two ports and uses PIA port B to switch memory, leave out line 6025 and change both TO 4 loops to TO 2.
Commercial support was thin: the APX titles Preschool Games (Bob Polaro, 1981) and Keypad Controller (Thomas D. Newton, 1982), a BASIC driver package whose Rev. 2 adds an option for two-player games.
The CX20 Driving Controller
The CX20 looks like a paddle but has no end stops and connects one per port. Introduced with the VCS in June 1977 (two came with Indy 500), it was marketed for the 400/800 only during 1979. Instead of a potentiometer value it outputs a two-bit Gray code on the up and down lines, changing sixteen times per revolution. The OS reads it as an ordinary joystick, so STICK(n) cycles through 15, 13, 12, 14 (clockwise) or 15, 14, 12, 13 (anticlockwise), and the fire button is STRIG(n):
10 S=STICK(0):IF S<>L THEN PRINT S:L=S
20 GOTO 10
Software has to watch the sequence to work out direction; the controller reports only relative movement, at a much lower resolution than a mouse. Recent 8-bit games for it include Peter J. Meyer's Megaoids (2016), Tempest Elite and Tile Smashers (both 2017), published by Video 61.
Using them today
- Any port works on an XL/XE for single-controller software, but four-keypad programs need a 400/800.
- Emulation: Altirra can map both keyboard and driving controllers to PC input devices.
Credits
- Picture: An Atari CX50 Keyboard Controller. — Evan-Amos, via Wikimedia Commons (Public domain)
- comp.sys.atari.8bit FAQ (Michael Current) — 6.3 (CX20, CX21, CX23, CX50), 8.5 (keyboard controller software), 8.12 (driving controller software) — Michael Current (comp.sys.atari.8bit FAQ)
- Altirra Hardware Reference Manual — 7.8 CX-20 Driving Controller, 7.9 CX-21/23/50 Keyboard Controller — Avery Lee (Altirra)
- Atari 400/800 Operating System User's Manual — Section 11 'Keyboard Controller Sensing' (Fig. 11-4 listing) and Appendix L J8/J9 (driving controllers) — ksquiggle
- AtariMania — Keypad Controller (APX, 1982) — AtariMania, 1982
