The ports
Controllers are read through two chips. The RIOT’s port A (SWCHA at $280) carries the joystick directions, the paddle buttons and the keypad rows; its direction register SWACNT ($281) sets each bit as input (0) or output (1). Port B (SWCHB at $282) is wired to the console switches; SWBCNT ($283) is hardwired as input in the Guide’s words, so normally 0. The TIA has six input pins read in bit 7 of INPT0 to INPT5 (read addresses $08 to $0D, as the memory map lists them; Nocash writes them as $38 to $3D, the same registers through the mirror). INPT0 to INPT3 are the dumped inputs for the paddle pots: bit 7 of VBLANK set connects them to ground (this discharges the capacitors) and clear lets them charge. INPT4 and INPT5 are the fire buttons: with bit 6 of VBLANK clear they read the pin directly; with it set they are latched: a latch starts at 1 and falls to 0 at the first low level on the pin and stays 0 until bit 6 is cleared (Programmer’s Guide 12.0 and TIA 8). Sources: the Stella Programmer’s Guide (the PIA section 4 and 5, the TIA input ports) and the Atari 2600 Specifications by Martin Korth (Nocash, controller chapters); the page says where only one of them speaks. INPT4 belongs to the left port (player 0) and INPT5 to the right (player 1) (Nocash, joystick table).
The two ports are left (player 0) and right (player 1). Pins are those of the 9-pin connector, listed on the connectors page.
Joystick
Set port A as input (SWACNT = $00). A 0 in a data bit means that switch is closed; all ones in a player’s four bits means the stick is centred (Guide 5.3). The fire button is INPT4 (player 0) or INPT5 (player 1) bit 7, 0 when pressed (Nocash).
| Direction | Player 0 (left port) | Player 1 (right port) |
|---|---|---|
| Up | SWCHA bit 4 | SWCHA bit 0 |
| Down | bit 5 | bit 1 |
| Left | bit 6 | bit 2 |
| Right | bit 7 | bit 3 |
| Fire | INPT4 bit 7 | INPT5 bit 7 |
Paddles
A paddle has a knob (a potentiometer) and a button. Two paddles share one port through a Y cable, so four can be used. The buttons are read from port A as input, 0 when pressed (Guide 5.4, Nocash):
| Paddle | Port A bit | Pot input |
|---|---|---|
| 0 (left paddle, player 0) | 7 | INPT0 |
| 1 (right paddle, player 0) | 6 | INPT1 |
| 2 (left paddle, player 1) | 3 | INPT2 |
| 3 (right paddle, player 1) | 2 | INPT3 |
The pots are read by timing. The program sets bit 7 of VBLANK to discharge the capacitor in the console, clears it, and then counts the time until bit 7 of INPTx turns to 1 as the capacitor charges through the pot (Guide 12.1). Nocash gives the values: a 68 nF capacitor in the console, a linear 1 MΩ pot in the paddle in series with a 1.8 kΩ resistor in the console, and a time of about 380 scanlines at 1 MΩ (one end of the turn), about 190 at 500 kΩ (centre) and 0 at 0 Ω (the other end). The count varies by at least one line even without a move and depends on the parts and the warm-up; a program should give up after about 1000 lines (which also detects that no paddle is plugged in) and may need more than one frame to reach the end of the range.
Keypad
The keypad controller has 12 keys in 4 rows and 3 columns. The program sets port A as output (SWACNT = $FF), drives one row low, waits, and reads the columns. The Guide requires a delay of 400 µs between writing the port and reading the TIA inputs.
| Row (driven low) | Player 0 | Player 1 | Keys |
|---|---|---|---|
| Top | SWCHA bit 4 | bit 0 | 1 2 3 |
| Second | bit 5 | bit 1 | 4 5 6 |
| Third | bit 6 | bit 2 | 7 8 9 |
| Bottom | bit 7 | bit 3 | * 0 # |
| Column (0 = pressed) | Player 0 | Player 1 | Keys |
|---|---|---|---|
| Left | INPT0 bit 7 | INPT2 bit 7 | 1 4 7 * |
| Middle | INPT1 bit 7 | INPT3 bit 7 | 2 5 8 0 |
| Right | INPT4 bit 7 | INPT5 bit 7 | 3 6 9 # |
The Guide names INPT0, INPT1 and INPT4 as the three column inputs of a keypad in the left port; the player 1 inputs and the pull-up detail (the middle and left columns need external 4.7 kΩ pull-ups to pin 7) are Nocash’s. Some software uses two keypads at once (the BASIC Programming cartridge).
Driving (steering) controller
A knob on a 16-position rotary switch that turns endlessly, plus a button; only one fits on each port. Only two bits of the switch are connected, so the output repeats every four positions (a Gray-code pair that steps through four states). Port A is input. Nocash lists the two position bits and the button:
| Player 0 | Player 1 | |
|---|---|---|
| Position bit (pin 1) | SWCHA bit 4 | SWCHA bit 0 |
| Position bit (pin 2) | SWCHA bit 5 | SWCHA bit 1 |
| Button (0 = pressed) | INPT4 bit 7 | INPT5 bit 7 |
Nocash names two programs that use it, Indy 500 and a homebrew sketch program. The Programmer’s Guide does not describe the controller.
Light gun
The XG-1 gun was made in 1987 for the Atari XE computers. Nocash gives the pins as a deduction quoted from a forum post, not a measured fact: pin 1 trigger (active high), pin 6 light sensor (active low), pin 7 +5 V, pin 8 ground. In the left port the trigger is SWCHA bit 4 (1 = pressed) and the sensor INPT4 bit 7 (0 = it sees light); in the right port the trigger is bit 0 and the sensor INPT5 bit 7. The games that support it are few (Nocash lists Sentinel and some homebrew and prototype programs).
Trackball and mouse
Atari made several incompatible trackballs and mice for the joystick port (Nocash, which also gives a schematic). In joystick mode a trackball produces left, right, up and down on the joystick bits, so every joystick game works with it but the speed information is lost. In trackball mode the X clock appears on pin 2 and the X direction on pin 1 (and the Y clock on pin 4, Y direction on pin 3); the Atari mouse sends the two phases of each axis directly to the port. Nocash states that almost no 2600 game uses trackball mode (a hack of Missile Command is the exception) and that the models differ:
| Model | Joystick | Trackball | Atari mouse | Amiga mouse |
|---|---|---|---|---|
| Old CX-22 | yes | no | no | no |
| New CX-22 | yes | yes | no | no |
| Old CX-80 | yes | yes | no | no |
| New CX-80 | yes (query in the source) | no | yes | no |
| Atari mouse | no | no | yes | no |
| Amiga mouse (swapped pins) | no | no | no | yes |
Other controllers Nocash lists by name only: the Foot Craz pad (Video Jogger, Video Reflex) and the Joyboard (Mogul Maniac, Off Your Rocker, Surf’s Up).
Console switches
Set SWBCNT to $00 and read SWCHB (Guide 4.1; Nocash agrees):
| Bit | Switch | Meaning |
|---|---|---|
| 0 | Game reset | 0 = pressed |
| 1 | Game select | 0 = pressed |
| 2 | not used | |
| 3 | Colour / black and white | 0 = B/W, 1 = colour (always 0 on SECAM, where it is wired to ground: Nocash) |
| 4, 5 | not used | |
| 6 | Player 0 difficulty | 0 = amateur (B), 1 = pro (A) |
| 7 | Player 1 difficulty | 0 = amateur (B), 1 = pro (A) |
Older consoles used switches for reset and select. The reset button resets no hardware and the colour switch changes nothing in the picture unless the program reads it (Nocash). The power switch and the channel switch are not readable. The three unused bits can be made outputs through SWBCNT and used as three bits of storage, as Combat does (Nocash).
Not described
Known, not yet covered
- Reference: the CompuMate keyboard is described on the bank-switching page only as far as the cartridge addresses; the keyboard matrix, tape and RAM control bits of port A are in Kevin Horton’s document and are not repeated here. The Supercharger tape input is on the bank-switching page.
- Reference: the schematics of the trackball and mouse electronics and the unreleased or rare controllers beyond the names above.
Unknown
- Reference: the light gun pin-out rests on one forum post quoted by Nocash and no gun was available to measure.