The controller ports are read through two CPU addresses, $4016 and
$4017. The table of every I/O address is on
CPU memory map. This page describes the
protocol, the standard controller, the other devices the wiki documents in detail, reading
code and the connectors.
The standard procedure
- Write 1 to
$4016so the controller samples its buttons. - Write 0 to
$4016to end the poll. - Read the data one bit at a time from
$4016(port 1) or$4017(port 2).
$4016 write
7 bit 0
---- ----
xxxx xEES
|||
||+- Controller port latch bit (OUT0)
++-- Expansion port latch bits (OUT1, OUT2)
The low 3 bits are latched and held; they are always present on the OUT lines of the controller port and the expansion port. Other bits are ignored. On the standard controller, bit 0 drives the parallel/serial control of a 4021 shift register: 1 loads the buttons, 0 returns it to serial mode. While the strobe is high the shift register keeps reloading and every read returns the state of button A.
$4016 and $4017 read
7 bit 0
---- ----
xxxD DDDD
|||+-++++- Input data lines D4 D3 D2 D1 D0
+++------- Open bus
A read sends a clock pulse to the CLK line of one port. $4016 reads only port 1 and $4017 only port 2. The value is inverted: a high line reads as 0. The data lines:
| Line | Used by |
|---|---|
| D0 | NES standard controller; Famicom hard-wired controllers |
| D1 | Famicom expansion port controllers |
| D2 | Famicom microphone (controller 2, $4016 only) |
| D3 | Zapper light sensor |
| D4 | Zapper trigger |
The NES ports bring out only D0, D3 and D4. The Famicom hard-wired pads use D0 and (for the microphone) $4016 D2; other lines come through the expansion port. The NES expansion port was never used commercially but connects all five lines to both ports. The Four Score passes only D0 of its controllers.
Clock timing
CLK is R/W nand (address = $4016 or $4017): it is low only while the CPU reads one of those addresses. When it falls, the buffer inside the NES latches the data lines. When it rises again, the controller’s shift register shifts one bit.
Lines not driven
Unconnected lines are pulled to 0 or show open bus. Bits 7 to 5 are always open bus, so they hold the high byte of the address ($40). Paperboy and some other games need a read to return exactly $40 or $41.
| Line | NES-001 ($4016, $4017) | NES-101 $4016 | NES-101 $4017 | Famicom $4016 | Famicom $4017 |
|---|---|---|---|---|---|
| D0 | 0 if not connected | 0 if not connected | 0 if not connected | 0 if not connected | 0 if not connected |
| D1 | 0 if not connected | always 0 | always 0 | 0 if not connected | 0 if not connected |
| D2 | 0 if not connected | open bus | always 0 | microphone on controller 2 | 0 if not connected |
| D3 | 0 if not connected | 0 if not connected | 0 if not connected | open bus | 0 if not connected |
| D4 | 0 if not connected | 0 if not connected | 0 if not connected | open bus | 0 if not connected |
| D5 to D7 | open bus | ||||
The standard controller
After the strobe, the first 8 reads of D0 give the buttons in this order (1 = pressed): A, B, Select, Start, Up, Down, Left, Right. Official controllers return 1 on every later read, because the shift register’s serial input is grounded and the NES inverts the line. Some third-party controllers (the wiki names the U-Force) return 0. With no controller connected the bit reads 0 (internal pull-ups and the inverter).
- Hardware: a 4021 8-bit parallel-to-serial shift register. OUT (
$4016bit 0) is its parallel/serial control. CLK shifts on a low-to-high edge. D0 is its Q8 output (inverted by the NES). Each of the 8 parallel inputs has a pull-up of about 10 kohm; a pressed button grounds it. Parallel input 8 is button A. - Famicom: the hard-wired second controller has no Select or Start (they read 0), and a microphone on
$4016D2 that gives an immediate 1-bit reading whenever it is read. Games track changes of this bit instead of a fixed state, so the microphone is useful for noise, such as blowing. Its audio is mixed with the APU output before the cartridge edge, ahead of expansion audio. The later AV Famicom has detachable controllers like the NES, two identical pads, and no microphone. - Famicom expansion controllers give the same 8-bit report through D1. Games often OR D1 and D0 so that either works; some games do not support them.
- Turbo controllers work like standard ones, but an oscillator (15 to 30 Hz) toggles some buttons. A controller must not toggle on every strobe pulse, or games that read in a loop until two reads match can stall.
- PAL consoles (for example FRA, HOL, NOE) have protection diodes on the controller port. They stop OUT and CLK working unless the controller pulls them high, so only PAL pads (NES-004E, with a 3.6 kohm resistor on each of the two inputs to 5 V) can be read. NTSC consoles and early PAL ones (at least SCN) read both types. The Four Score model NESE-034 version 1.1 has the diodes too.
The DPCM conflict
If the DMC channel starts a DMA read on the same cycle as the CPU reads $4016 or $4017, the address bus changes for a cycle and the shift register sees an extra clock edge. The program sees this as a deleted bit. On the standard controller the following 1 bit takes the place of the 8th bit, usually seen as a spurious Right press. The 2A07 (PAL) fixes it. Many emulators do not simulate it. Two cures:
- Repeat the read until two reads in a row match. Used by commercial games. It must finish both passes within the fastest DMC period minus 4 (428 cycles), so read one controller at a time; it cannot be used with devices that lose state when read (SNES mouse), that need a long time between reads (Arkanoid controller) or that send too much data (Famicom Network Controller). The sample byte or the frame IRQ may still be corrupted.
- Synchronise with OAM DMA. The APU alternates “get” and “put” cycles; DMC fetches normally fall on put cycles, and the cycle after an OAM DMA is a get. If every
$4016and$4017read falls on a get cycle, no glitch occurs. The routine must follow the OAM DMA directly, take an odd number of cycles for the strobe code and an even number for the loop, and not cross a page with its branch. Longer routines must also align all write cycles (a DMC reload takes 3 cycles after an odd number of CPU write cycles, else 4; during OAM DMA an even number; at the end of OAM DMA an odd number, which flips the parity).
Any read of $4000–$401F gives DMC DMA a chance to clock a controller, so even indexed writes to sound registers can disturb devices that cannot recover state. Interrupts can break both methods.
Reading code (ca65)
The shortest read keeps the result in zero page and uses a ring counter: the 1 loaded first is shifted out after eight bits and ends the loop. It takes 132 cycles and ignores the Famicom expansion controller.
JOYPAD1 = $4016
JOYPAD2 = $4017
readjoy:
lda #$01
sta JOYPAD1 ; strobe high: buttons are continuously reloaded
sta buttons
lsr a ; A is now 0
sta JOYPAD1 ; strobe low: serial mode
loop:
lda JOYPAD1
lsr a ; bit 0 to carry
rol buttons ; carry to bit 0, bit 7 to carry
bcc loop
rts
Result bits (1 = pressed): bit 7 A, 6 B, 5 Select, 4 Start, 3 Up, 2 Down, 1 Left, 0 Right.
The usual two-controller routine also reads the Famicom expansion data. The mask is needed because the upper bits are open bus:
readjoyx2:
ldx #$00
jsr readjoyx ; controller 1
inx ; fall through for controller 2
readjoyx: ; X = 0 or 1
lda #$01
sta JOYPAD1
sta buttons, x
lsr a
sta JOYPAD1
loop:
lda JOYPAD1, x
and #%00000011 ; D0 and D1 only
cmp #$01 ; carry set if non-zero
rol buttons, x
bcc loop
rts
A combined loop that reads both controllers with one strobe (lda JOYPAD1 / and #3 / cmp #1 / rol buttons+0 / lda JOYPAD2 / and #3 / cmp #1 / rol buttons+1 / bcc, with buttons+1 as the ring counter) is shorter but not DPCM safe. The safe repeated-read form calls readjoyx, saves buttons,x, calls it again and loops until the two match. The OAM-synchronised form, placed right after sta $4014:
lda #OAM
sta $4014 ; OAM DMA
ldx #1
stx buttons+0 ; zero page
stx $4016
dex
stx $4016
loop:
lda $4017
and #3
cmp #1
rol buttons+1, x ; X = 0, wastes a cycle for alignment
lda $4016
and #3
cmp #1
rol buttons+0
bcc loop ; must not cross a page
Handy operations from the wiki: define the button flags (A = 1<<7 … Right = 1<<0); newly pressed = (last EOR $FF) AND now; newly released = (now EOR $FF) AND last; reject opposite directions with buttons AND %00001010, shift right 1, AND with buttons (non-zero means Up+Down or Left+Right) and keep the last frame’s direction bits; more than one direction bit set is diagonal (A AND (A-1) non-zero).
Four player adapters
- “Simple” Famicom adapters (JoyPair, Twin Adapter): the Famicom has one expansion port, so these redirect the second port to D1 of
$4017(players 3 and 4). Not all expansion signals pass through, so many devices do not work with them. - Hori 4 Players Adapter (Famicom, D1) and Four Score (NES, D0): they strobe all controllers at once. In 4-controller mode, ports 1 and 3 appear on
$4016and ports 2 and 4 on$4017. The report is 8 bits of the first controller, 8 bits of the second, 8 bits of a signature, then all 1. The read counter resets while OUT0 is 1. The Hori adapter has 2- and 4-controller modes by a switch.
| Read of | Bits 0 to 7 | Bits 8 to 15 | Bits 16 to 23 | Bits 24 on |
|---|---|---|---|---|
Four Score $4016 (D0) | controller 1 | controller 3 | signature: bit 19 = 1, others 0 | 1 |
Four Score $4017 (D0) | controller 2 | controller 4 | signature: bit 18 = 1, others 0 | 1 |
Hori $4016 (D1) | controller 1 | controller 3 | signature: bit 18 = 1, others 0 | 1 |
Hori $4017 (D1) | controller 2 | controller 4 | signature: bit 19 = 1, others 0 | 1 |
The Four Score has two turbo switches (A and B) that apply to all controllers; they force the bit to 0 at about every 2 frames: the A turbo on the first read after a strobe, the B turbo on the second (in 2-controller mode again after each 32 reads). Inside both devices is a 22-pin chip, the FPA-S01, with a decoder and, per address, a shift register, 5-bit counter and multiplexer. The NES Satellite (4 controllers, wireless) has an unknown protocol; its switch selects standard controllers or the Zapper. With these adapters up to 8 controllers can be used on an AV Famicom, 6 on a Famicom with its hard-wired pads. The wiki lists the games that support them.
Zapper
A light gun, best known from Duck Hunt. It reads the brightness of the CRT where it points. It can be in either NES port; most games use port 2. The Famicom Zapper works logically the same but connects only to the expansion port, so it reads from $4017.
7 bit 0
---- ----
xxxT Wxxx
| |
| +---- Light sensed at the current scanline (0: detected, 1: not detected)
+------ Trigger (0: released or fully pulled, 1: half-pulled)
- The Vs. System Zapper is not compatible: it answers like a standard controller with an 8-bit report
0, 0, 0, 0, 1, 0, light (inverted), trigger(light sense is Left, trigger is Right, Up always pressed), and its light bit is 1 when light is detected. - The photodiode stays on about 26 lines for pure white, 24 for light grey and 19 for dark grey. A model for emulators: luminance charges a capacitor that drains exponentially over several lines, and the bit is active while the voltage is above a threshold.
- The trigger is 0 while open, 1 half-pulled, 0 again when pulled fully. A 10 microfarad capacitor and the console’s 10 kohm pull-up make the “released” change take about 100 ms after a half pull. Some clones (Tomee Zapp Gun) give 1 when not pulled and 0 when pulled, which works with most games because they fire on a 1 to 0 change.
- The sensor has a filter around the scanline frequency (about 15 kHz), which hides slow light changes but also dims many LCD televisions. Games expect no display lag.
- Usual game sequence: check the trigger each frame. In vblank check that no light is detected (if bit 3 is clear in vblank, a standard controller is probably plugged in), late in vblank so light drains. Optionally draw white and time when light is sensed to find the vertical position. For each target draw a black screen with one white (
$20) or light ($31–$3C) box, and watch for the light bit going low through the whole frame (the sensor turns on and off over 10 to 25 lines). A hit on any target is a hit. Then restore the screen.
Power Pad and Family Trainer Mat
The Power Pad (Family Fun Fitness in Europe) has twelve sensors in a 3 × 4 grid. It uses D3 and D4 of either port. Side B is numbered 1 to 12 in rows of four. Side A has only eight marked places and sensors 1, 4, 9 and 12 are unmarked but still send a signal.
$4016 write: xxxx xxxS S = strobe (1 records the buttons, 0 lets them be read back, two at a time)
$4016/$4017 read: xxxH Lxxx
L (bit 3): serial data from buttons 2, 1, 5, 9, 6, 10, 11, 7
H (bit 4): serial data from buttons 4, 3, 12, 8 (the following 4 reads give H = 1)
The first 8 reads give the buttons (1 = pressed), later reads return H = 1 and L = 1. Save both bits of every read. Beware of DPCM bit deletions.
The Family Trainer Mat (Famicom) and the Tap-tap Mat use a different protocol through the expansion port. Write $4016 bits 2 to 0 as xxxx xABC: A set ignores the top row (buttons 1 to 4), B the middle row (5 to 8), C the bottom row (9 to 12). Read $4017 as xxxD EFGx: D is the left-most column (1, 5, 9), E left-centre (2, 6, 10), F right-centre (3, 7, 11), G the right-most column (4, 8, 12). A bit reads 0 if a button in the selected rows is pressed, 1 if none. The matrix must be scanned in software; it may need about a millisecond between rows because of parasitic capacitance. The mat has diodes for n-key rollover.
Arkanoid controller (Vaus)
Used by Arkanoid, Arkanoid II and Taito Chase H.Q.. It has a fire button and a knob on a potentiometer. The Famicom and NES versions use different bits.
$4016 write: xxxx xxxC C 0 to 1 starts an analog-to-digital conversion (return C to 0 quickly)
NES read: xxxD Bxxx D = knob data (9 bits, inverted, MSB first), B = fire (1 = pressed)
Famicom: $4016 xxxx xxBx (B = fire) $4017 xxxx xxDx (D = knob data)
The conversion takes up to 7 ms (a smaller value converts faster); strobing again too soon returns bad data, and extra strobes during a conversion are ignored. The fire button is not affected by the strobe. The 8 latched bits can be read after a strobe; the 9th bit is lost if a conversion starts before it is read, and games ignore it. Reading past the 9th bit repeats it. Turning the knob right increases the value. The knob has a 180 degree range and about $140 steps ($A0 in an 8-bit read). Games expect: Arkanoid $62–$02, Arkanoid II $4D–$E2 ($F2 with the tiny paddle). The conversion uses two timers (set by the pots) and a 12-bit counter; if OUT0 is 1 when a conversion would end, it continues until OUT0 clears. Hardware details such as the Arkanoid II expansion port version are on the wiki page and are not copied here.
Port pinouts
NES controller port (7 pins)
Directions are from the console’s jack. Pins: GND, CLK (out), OUT (out), D0 (in), +5 V, D3 (in), D4 (in). Wire colours of official pads:
| Signal | NES | Famicom player 1 | Famicom player 2 |
|---|---|---|---|
| +5 V | white | white | blue |
| OUT | orange | orange | yellow |
| D0 | yellow | red | orange |
| GND | brown | brown | red |
| CLK | red | yellow | white |
| D2 | none | none | brown |
The 9-pin famiclone port and the 15-pin famiclone port carry the same signals; the 15-pin port is a subset of the Famicom expansion port, and audio may not be present. A SNES controller port (FC Twin) has 7 pins: 1 +5 V, 2 clock, 3 out (latch), 4 D0, 5 D1, 6 I/O, 7 ground. The standard pad uses D0 and the OUT/CLK pair; the SNES pad is backward compatible with the NES protocol.
The PAL protection diodes: +5 V, D3, D4 and D0 each have a diode towards the jack, and OUT and CLK a diode in the opposite sense, so the controller must pull OUT and CLK high.
Famicom expansion port (15-pin DA-15)
| Pin | Signal | Pin | Signal |
|---|---|---|---|
| 1 | GND | 9 | /OE for joypad 2 ($4017 read strobe) |
| 2 | SOUND (out) | 10 | OUT2 ($4016 bit 2) |
| 3 | /IRQ | 11 | OUT1 ($4016 bit 1) |
| 4 | joypad 2 /D4 (in) | 12 | OUT0 ($4016 bit 0, strobe) |
| 5 | joypad 2 /D3 (in) | 13 | joypad 1 /D1 (in) |
| 6 | joypad 2 /D2 (in) | 14 | /OE for joypad 1 ($4016 read strobe) |
| 7 | joypad 2 /D1 (in) | 15 | +5 V |
| 8 | joypad 2 /D0 |
The /D lines are inverted before the CPU. Joypad 2 /D0 is an output of the permanently connected pad on the RF Famicom, Twin Famicom and Famicom Titler; on the AV Famicom it may be an input, but the Multi Adapter AX-1 expects it to be an output. /OE is asserted while reading $4016 (joypad 1) or $4017 (joypad 2); devices often use it as a clock. OUT2 to OUT0 follow the values written to $4016 bits 2 to 0, updated every APU cycle (2 CPU cycles). /IRQ direction depends on the cartridge: many drive it push-pull, so it may not be usable as an input. SOUND is analogue audio out: before expansion audio on the RF Famicom, after it on the AV Famicom. Feeding audio in is not advised.
NES expansion port (48-pin edge)
Under the console behind a tab that has to be cut. The connector is 2.6 mm thick, slightly keyed at the front corners. Never used commercially. Pins (back to front, left column 1 to 24, right column 48 to 25):
| Pin | Signal | Pin | Signal |
|---|---|---|---|
| 1 | +5 V | 48 | +5 V |
| 2 | GND | 47 | GND |
| 3 | audio mix input | 46 | not connected |
| 4 | /NMI (open collector) | 45 | OUT2 ($4016 bit 2) |
| 5 | A15 | 44 | OUT1 |
| 6 | EXP9 | 43 | OUT0 (strobe) |
| 7 | EXP8 | 42 | EXP0 |
| 8 | EXP7 | 41 | EXP1 |
| 9 | EXP6 | 40 | EXP2 |
| 10 | EXP5 | 39 | EXP3 |
| 11 | /OE for joypad 2 ($4017 read strobe) | 38 | EXP4 |
| 12 | joypad 1 /D1 | 37 | /OE for joypad 1 ($4016 read strobe) |
| 13 | joypad 1 /D3 (see note) | 36 | joypad 1 /D4 (see note) |
| 14 | /IRQ | 35 | joypad 1 /D0 (see note) |
| 15 | joypad 2 /D2 | 34 | duplicate of pin 37 |
| 16 | joypad 2 /D3 (see note) | 33 | joypad 1 /D2 |
| 17 | duplicate of pin 11 | 32 | CPU D0 |
| 18 | joypad 2 /D4 (see note) | 31 | CPU D1 |
| 19 | joypad 2 /D0 (see note) | 30 | CPU D2 |
| 20 | joypad 2 /D1 | 29 | CPU D3 |
| 21 | video out | 28 | CPU D4 |
| 22 | amplified audio | 27 | CPU D5 |
| 23 | unregulated power adapter Vdd | 26 | CPU D6 |
| 24 | 4.00 MHz CIC CLK | 25 | CPU D7 |
Note: joypad 1 and 2 /D0, /D3 and /D4 are available as inputs if nothing plugged into the matching controller port uses them (D0 is unavailable with a standard controller or Four Score; D3 and D4 with a Zapper, Arkanoid controller or Power Pad). /IRQ depends on the cartridge; ASICs mostly drive it push-pull, so use a series 1 kohm resistor (it overcomes the console’s 10 kohm pull-up and limits an ASIC’s output current to about 5 mA). The wiki’s separate “EXP pins” page is not summarised here.
Which port pins each device uses
The two ports share one set of lines. Output: writing $4016 bits 2 to 0 sets OUT2, OUT1 and OUT0 (OUT0 goes to the controller ports, all three to the expansion port). Input: reading $4016 asserts /OE1 and reading $4017 asserts /OE2, and the low five bits of each read are D4 to D0. What is wired differs by console:
- NES: only D0, D3 and D4 of both controller ports are connected; all of D0 to D4 of both reads are connected to the 48-pin expansion port.
- Original Famicom:
$4016D0 and D2 and$4017D0 are permanently connected to the two built-in pads (D2 of$4016is the microphone in pad 2, which is not affected by OUT0 or /OE2);$4016D1 and all of$4017D0 to D4 are on the 15-pin expansion port. - AV Famicom: only D0 reaches the detachable controller ports; the expansion port is unchanged.
| Device | Outputs written to $4016 | Joypad 1 side ($4016 read) | Joypad 2 side ($4017 read) |
|---|---|---|---|
| Standard controller, port 1 | OUT0 | /OE1, D0 | - |
| Standard controller, port 2 | OUT0 | - | /OE2, D0 |
| Standard controller on the expansion port | OUT0 | /OE1, D1 (and the audio line) | - |
| Arkanoid controller, port 2 (NES) | OUT0 | - | /OE2, D4, D3 |
| Arkanoid controller, expansion port | OUT0 | D1 | /OE2, D1 |
| Arkanoid II controller (two controllers) | OUT0 | D1 | /OE2, D4, D3, D1 |
| Bandai Hyper Shot | OUT2, OUT1, OUT0 | /OE1, D1 | D4, D3 (and the audio line) |
| Exciting Boxing punching bag | OUT1 | - | D4, D3, D2, D1 |
| FAM-NET keyboard | OUT2, OUT1, OUT0 | - | D4, D3, D2, D1 |
| Family Trainer mat and Pokkun Moguraa Tap-tap mat | OUT2, OUT1, OUT0 | - | D4, D3, D2, D1 |
| Family BASIC Keyboard | OUT2, OUT1, OUT0 | - | D4, D3, D2, D1 |
| Famicom 3D System glasses | OUT1 | - | - |
| Famicom Network System controller | OUT0 | /OE1, D1 | - |
| Four Score (and NES Satellite) | OUT0 | /OE1, D0 | /OE2, D0 |
| Hori 4 Players Adapter (Famicom) | OUT0 | /OE1, D1 | /OE2, D1 |
| Hori Track | OUT0 | - | /OE2, D1 |
| Jissen Mahjong controller | OUT2, OUT1, OUT0 | - | /OE2, D1 |
| Konami Hyper Shot | OUT2, OUT1 | - | D4, D3, D2, D1 |
| Oeka Kids tablet | OUT1, OUT0 | - | D3, D2 |
| Coconuts Japan pachinko controller | OUT0 | /OE1, D1 | - |
| Party Tap | OUT0 | - | /OE2, D4, D3, D2 |
| Power Pad, port 2 | OUT0 | - | /OE2, D4, D3 |
| Port test controller | OUT0 | /OE1, D4, D3, D0 | /OE2, D4, D3, D0 |
| TV-NET controller and TV-NET Rank 2 controller | OUT0 | /OE1, D1 | - |
| Zapper, port 2 or expansion port | - | - | D4, D3 |
| Zapper (Vs. System), port 1 | OUT0 | /OE1, D0 | - |
Controllers that use the NES ports can be plugged into either port and then use that port’s /OE and data lines, though games may expect a controller in one port only. A Famicom expansion controller may wire the audio line to a headphone jack (the IQ502 joypad does). The Casel Zapper plays its own sound when the trigger is pulled, independent of the console’s audio. The wiki’s list of the devices has more entries than this table; the ones this page does not describe are in Not covered.
Family BASIC Keyboard (HVC-007)
Released in 1984 with the Family BASIC package; a 72-key matrix keyboard on the Famicom expansion port that with the data recorder gave the Famicom the abilities of a home computer of the time. Layout, in the text form the wiki gives (CH is CLR HOME):
F1 F2 F3 F4 F5 F6 F7 F8
1 2 3 4 5 6 7 8 9 0 - ^ ¥ STOP CH INS DEL
ESC Q W E R T Y U I O P @ [ RETURN UP
CTR A S D F G H J K L ; : ] KANA LEFT RIGHT
SHIFT Z X C V B N M , . / _ SHIFT DOWN
GRPH SPACE
The key marked DEL is a backspace. There is no backslash key; the yen key stands for it. The kana are in grid (alphabetical) order, not the arrangement of modern Japanese computers.
$4016 write: xxxx xKCR
R (bit 0): reset the keyboard to the first row
C (bit 1): select the column; the row is incremented when this bit goes from high to low
K (bit 2): enable the keyboard matrix (0 holds every voltage inside at 5 V, so reads are always 0)
$4017 read: xxxK KKKx
bits 4 to 1: key status of the selected row and column (a held key reads 0)
($4016 reads come from the data recorder, see below.)
Incrementing from the keyless tenth row wraps to the first row. As on the Family Trainer mat, parasitic capacitance means the program must wait: Family BASIC and the FDS BIOS wait at least 12 cycles (16 counting load instructions) between resetting the keyboard and selecting column 0, and about 50 cycles after selecting each column before the output is valid.
Reading procedure used by Family BASIC and the FDS BIOS: write $05 to $4016 (row 0, column 0) followed by six NOPs; write $04 (select column 0, next row unless just reset) and delay about 50 cycles; read column 0 from $4017; write $06 (select column 1) and delay about 50 cycles; read column 1; repeat from the second step eight more times. The FDS BIOS ends the routine early if every key reads pressed on column 0 of any row (it takes that as the keyboard being absent) and writes $4016 with bit 2 clear at the end (disabling the matrix); Family BASIC always reads all rows and does not disable the matrix. No commercial FDS game is known to use the BIOS routine (the NES version of Zanac reuses it in its debug mode).
$4017 bit | col 0 bit 4 | 3 | 2 | 1 | col 1 bit 4 | 3 | 2 | 1 |
|---|---|---|---|---|---|---|---|---|
| Row 0 | ] | [ | RETURN | F8 | STOP | ¥ | RSHIFT | KANA |
| Row 1 | ; | : | @ | F7 | ^ | - | / | _ |
| Row 2 | K | L | O | F6 | 0 | P | , | . |
| Row 3 | J | U | I | F5 | 8 | 9 | N | M |
| Row 4 | H | G | Y | F4 | 6 | 7 | V | B |
| Row 5 | D | R | T | F3 | 4 | 5 | C | F |
| Row 6 | A | S | W | F2 | 3 | E | Z | X |
| Row 7 | CTR | Q | ESC | F1 | 2 | 1 | GRPH | LSHIFT |
| Row 8 | LEFT | RIGHT | UP | CLR HOME | INS | DEL | SPACE | DOWN |
Hardware: a CD4017 decade counter scans the rows, a CD4019 quad AND-OR gate and one sixth of a CD4069 hex inverter make a quad 1-of-2 selector (like a CD4519 or 74157), and another three inverters interface to the data recorder. Like the Commodore 64 keyboard and unlike a PC keyboard, the sixteen keys for ASCII $2C to $3B all have their ASCII code XORed with $10 when SHIFT is pressed, which simplifies decoding. Detection in other games: Lode Runner offers saving level data to tape in edit mode only if it finds the keyboard; its routine (CPU $E9B8) selects the tenth row and expects $4017 AND $1E to return $1E, then writes $00 to $4016 and expects the same read to return $00.
Family BASIC Data Recorder (HVC-008)
Made by Matsushita (Panasonic) for Nintendo and released in Japan in 1984 as an addition to the keyboard for reading and writing BASIC programs; games that use it include Family BASIC, Family BASIC V3, Arkanoid II, Castle Excellent, Excitebike, Lode Runner, Mach Rider and Wrecking Crew. Any compact cassette player with 3.5 mm monaural jacks can stand in for it; the keyboard has the two jacks, and other expansion-port devices (the Hori SD Station, the ASCII Stick II Turbo) may offer the same interface.
$4016 write: xxxx xExS
S (bit 0): 1-bit DAC audio to the cassette
E (bit 2): when 0, audio readback always reads as binary 0 (5 V)
$4016 read: xxxx xxAx
A (bit 1): 1-bit ADC audio from the cassette
Audio to the recorder goes through a first-order high-pass at 100 Hz and is attenuated to 5 mV peak to peak. Played back, tape gives the low-passed derivative of what was recorded; this goes through a high-pass with a corner at 800 Hz before it is discretised; in simulation square waves from 600 Hz to the bandwidth of the tape are recovered. An emulator can just play back the bit stream as emitted. It is not known whether Family BASIC uses Kansas City Standard, Bell 103 or 202 or another encoding. Castle Excellent (recorder code mostly at $8000 to $80FE) saves with 1200 baud (“CUTS”) bit-reversed Kansas City Standard; Wrecking Crew uses the Sharp MZ tape format. Homebrew can adapt Chris Covell’s KCS generating and decoding routines.
Famicom Network Controller (HVC-051)
A 23-button controller for the Famicom Network System: a standard controller plus a number pad (rows 1 2 3 * C, 4 5 6 # ., 7 8 9 0, and an END button), usable with normal games. Select also reads “previous page”, Start “next page”, B “table of contents”, A “execute” and END “end of communication”. The protocol looks like a standard Famicom expansion-port controller, returning its result by reads of $4016 D1: after the first eight reads (the standard controller bits) the next sixteen return, in order, the buttons 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, *, #, ., C, a bit that is always 0, and END; as for the standard controller, reads after the first 24 return 1. The Super Famicom NTT Data keypad is the equivalent for that console.
SNES mouse and Hyperkin mouse
The Super NES Mouse (SNS-016, bundled with Mario Paint) works on an NES through an adapter that connects power, ground, clock, latch and data of the two extension cords; the Hyperkin “Hyper Click” optical mouse is mostly compatible with some quirks. It is read like a standard controller (latch $4016 bit 0 on and off, then reads of bit 0 or bit 1 of $4016 or $4017) but the report is 32 bits long: on an NES or AV Famicom the mouse can be on bit 0 through the front ports, on the original Famicom normally on bit 1 through the expansion port. The report, most significant bit first:
byte 1: 00000000 always zero
byte 2: RLSS 0001 R right button, L left button (1 = pressed), SS sensitivity (0 low, 1 medium, 2 high), signature 0001
byte 3: DYYY YYYY vertical displacement since the last read, D = direction (1 up, 0 down)
byte 4: DXXX XXXX horizontal displacement since the last read, D = direction (1 left, 0 right)
After the fourth byte the original mouse returns all 1s; the Hyperkin reads a single 1 and then 0s. The Hyper Click does not give a stable report if read too fast: at least 14 CPU cycles between reads and at least 28 cycles between the 16th and 17th bit. The displacements are sign and magnitude ($05 is five mickeys one way and $85 five the other), not two’s complement; when the magnitude is 0 the sign repeats the last used sign for that axis. Sensitivity of the original mouse is changed by clocking it (read $4016) while the latch is on; some mouse microcontroller revisions power up in an unknown state and return useless values until the sensitivity has been changed once. The Hyper Click has a button underneath instead, always reports sensitivity 0 and so cannot be detected by cycling. Setting 0 of the original responds linearly (50 counts per inch, values 0 to 63 but above 25 hard to produce); settings 1 and 2 remap the setting 0 values 0 to 7 through tables clamped at the highest value: setting 1 gives 0, 1, 2, 3, 8, 10, 12, 21 (then 21) and setting 2 gives 0, 1, 4, 9, 12, 20, 24, 28 (then 28). The Hyper Click’s two sensitivities scale with speed (0 to 31 and 0 to 63, the maximum at about 8 inches per second). More than two mice on an AV Famicom is not recommended: a mouse draws 50 mA, and changing player 1’s sensitivity also changes player 3’s (2 and 4). Reading while DPCM plays can lose bits and repeated reads do not work for a mouse (the read changes its state and it cannot be read fast enough), so the wiki gives code that reads the mouse and a standard or SNES controller with fixed cycle timing, with its branches not crossing a page and no NMI or IRQ allowed in it; the code is not copied here.
Konami Hyper Shot
A pair of two-button controllers required by Hyper Olympic and Hyper Sports (1985).
$4016 write: xxxx xEFx F (bit 1): 0 = enable player 1 buttons E (bit 2): 0 = enable player 2 buttons
$4017 read: xxxD CBAx A (bit 1) player 1 Run, B (bit 2) player 1 Jump, C (bit 3) player 2 Run, D (bit 4) player 2 Jump
The Run button is on the side of the controller nearer the cord. The bits of a player always read 0 if the matching enable bit is set. HAL’s Joyball controller supports the Hyper Shot with its turbo switch in the middle position (B is player 1 Jump and A is player 1 Run at 20 Hz turbo).
Oeka Kids tablet
A Bandai drawing tablet on the Famicom expansion port, used by two games on mapper 96. Little is known; the wiki says its information may be incorrect but works for the two games and two test ROMs.
$4016 write: xxxx xxAS S (bit 0): strobe (0 latch, 1 read mode) A (bit 1): advance to the next bit
$4017 read: xxxx DSxx S (bit 2): 1 if strobe is 0 or advance is 1, else 0
D (bit 3): 0 if strobe is 0, otherwise the inverted report bit
Bits can be read only while S is 1, and the tablet advances when S is 1 and A goes from 0 to 1. Writing $01 then $00, reading the standard controllers and writing $01 before the tablet works. To read one bit: write $03, wait for $4017 bit 2 to become 0, write $01, wait for bit 2 to become 1; without waiting for the slow microcontroller (up to about 200 cycles per edge; 18 bits take about 67 scanlines) the data is wrong. The 18 serial bits come most significant first and inverted: stylus X (8 bits, scaled to 0 to 239), stylus Y (8 bits, 0 to 255), stylus touching, and click (the grey space bar at the bottom is held); the games rescale by 256/240 and 240/256. X and Y are meaningless when the stylus is not touching; small Y values (below about $20) are the regions under the bezel with seven marked touch regions, bounding boxes not verified across units.
Miracle Piano
A 49-key MIDI synthesizer by Antex for The Software Toolworks (The Miracle Piano Teaching System); the NES software expects the “Miracle Cable” in controller port 1 and a standard controller in port 2. $4016 write bit 0 is the transfer direction and the MIDI serial data to the keyboard; $4016 read bit 0 is the MIDI serial data from it, and a read clocks the next bit of the current transfer in either direction. The interface is bidirectional with clocked shift registers, octets most significant bit first. Polling: raise OUT0 for 12 CPU cycles (about 6.7 microseconds), lower it, and clock a bit in by reading $4016 bit 0 (perhaps after six more cycles); if that bit is set, eight more inverted bits follow; this strobes OUT0 as usual so the controller in the other port can be polled meanwhile. Sending: raise OUT0 for about 79 cycles (44.1 microseconds, up to the first data bit), then set OUT0 to each of the eight bits and clock it out by reading $4016. Inter-bit time is about 16 cycles for transmission and about 18 for reception.
Turbo File
ASCII Corporation’s save-data device for the Famicom expansion port, in two models: the original (AS-TFO2) with 8 KiB of battery-backed SRAM (connecting to the expansion port or the ASCII Stick II Turbo’s OPTION port) and the Turbo File II (AS-TF21) with 32 KiB (HM62256ALP-15) split into four 8 KiB banks selected by a switch and a slot for “Data ROM” packs (two were sold, with team data for the Best Play Pro Yakyuu series). Both have a power LED and a write-protect switch. Games that support it include Best Keiba - Derby Stallion, the Best Play Pro Yakyuu series, Castle Excellent, Derby Stallion - Zenkoku Ban, Downtown - Nekketsu Monogatari, Dungeon Kid, Famicom Shougi - Ryuuousen, Fleet Commander, Haja no Fuuin, Itadaki Street, The Money Game 2, Ninjara Hoi! and the three Wizardry ports.
$4017 read: xxxx xDxx D (bit 2): data input
$4016 write: xxxx xCRD D (bit 0): data output R (bit 1): 0 = reset to address $0000 C (bit 2): clock (1 high, 0 low)
To reset to address $0000: write $00, then $02 to $4016. To read a bit and write it back unchanged: take the old bit from $4017 bit 2, write $06 OR old to $4016 (clock high), then $02 OR old (clock low). To write a bit: the same with the new bit. The address advances after 8 clocks, so a program seeks by resetting and performing dummy reads. Memory: offset $0000 is unused (a dummy byte skips it), the rest ($0001 to $1FFF) holds save files one after another and an invalid file ID marks free space. Common save file format (data transferred least significant bit first): 2 bytes ID “AB” ($41, $42), 2 bytes file size (16 plus N plus 2, counting title and checksum), 16 bytes ASCII title ending in $00 or $01, N bytes of data, 2 bytes checksum (the sum of the data bytes). Castle Excellent has no file name and uses a fixed 512 bytes at $0000 to $01FF, transferred most significant bit first: 1 byte unused, ID $AA, $55, then 509 bytes of data (ending with the code “BEDEUTUN” and unused bytes); its fixed location destroys any other file there, though later games (Fleet Commander, Wizardry V) manage it. File deletion is rare for lack of RAM for relocation: Derby Stallion - Zenkoku Ban can erase files from the end of the file system (not Castle Excellent data); the Super Famicom Wizardry V (Japanese version) can import party members from the Famicom Wizardry files and delete individual files.
Barcode Battler
Epoch’s handheld uses a barcode scanner; the Barcode Battler II added an output port for the Famicom and Super Famicom (a Famicom expansion-port cable came with Barcode World). Input: $4017 read bit 2 is the serial data. The format appears to be level-shifted RS-232 at 1200 baud: one start bit (must be 1, low), eight data bits least significant first (1 = low = zero, 0 = high = one) and one stop bit (must be 0, high). The data is a 20-byte ASCII string: a 13-character barcode followed by a 7-character ID. Barcode formats: EAN-13, EAN-8 (leading space padding) and ERROR (trailing space padding, a scanning error); an emulator should pad shorter codes to 8 or 13 characters with leading zeros (which also allows UPC-A and UPC-E in Barcode World, though the hardware support is unknown). IDs: EPOCH followed by carriage return and line feed, sent by the hardware, and SUNSOFT, which Barcode World also accepts.
SNES controller
The Super NES controller (SHVC-005, SNS-005, SNS-102) is read like the standard controller, with four extra buttons. Behind a suitable adapter it is a standard controller with a longer report. The 16-bit report is, in order:
0 B 1 Y 2 Select 3 Start 4 Up 5 Down 6 Left 7 Right
8 A 9 X 10 L 11 R 12-15 always 0
The first eight bits match the NES controller, with SNES B in the place of NES A and SNES Y in the place of NES B. The last four bits read 0 on a standard SNES controller. Other values there can mean another device, such as a mouse or the Virtual Boy controller. After the 16 bits every read returns 1. NES games with special support for it include Spook-O-Tron, Nova the Squirrel and Full Quiet. Source: NESdev Wiki, SNES controller.
Virtual Boy controller
The Virtual Boy controller speaks the NES protocol and homebrew games use it (Spook-O’-Tron, Candelabra - Estoscerro). After the strobe the 16 bits are:
0 right pad Down 1 right pad Left 2 Select 3 Start
4 left pad Up 5 left pad Down 6 left pad Left 7 left pad Right
8 right pad Right 9 right pad Up 10 L (rear left) 11 R (rear right)
12 B 13 A 14 always 1 15 battery voltage (1 = low)
It is much like the SNES report, where the right pad takes the place of the four face buttons. The last four bits (B, A, 1, battery) have no equivalent in the SNES report, so the constant 1 in bit 14 tells the two devices apart (and tells it from a mouse). Source: NESdev Wiki, Virtual Boy controller.
Partytap
Six separate one-button controllers in one unit, used by Casino Derby, both Gimmi a Break quiz games and Project Q. Write $4016 bit 0 to strobe the shift register. Reads of $4017 return the serial data in bits 2 (button 1 or 4), 3 (button 2 or 5) and 4 (button 3 or 6): the first read gives buttons 1 to 3, the second buttons 4 to 6, and the third apparently a detection value of $14. The device seems to need many cycles between operations; games wait 80 to 500 cycles between some of them. Source: NESdev Wiki, Partytap.
Doremikko Keyboard
A 36-key piano keyboard (21 white keys and 15 black keys, two and a half octaves) that Konami released with the FDS game DoReMikko. It has no sound hardware. It uses matrix logic like the Family BASIC keyboard, but with diodes, so any number of keys can be down together.
$4016 write: xxxx xxRI I (bit 0): increment the row R (bit 1): 1 = reset to the first row
$4017 read: xxxK KKKx K (bits 4-1): the keys of the selected row and column
Whether the increment is a 0 to 1 or a 1 to 0 transition, and whether a reset also resets the column, is not known. Each read of $4017 switches between the two columns. A key that is down reads as 1. The key numbers by row, with bit 4 first in each column group:
column 0 (bits 4 3 2 1) column 1 (bits 4 3 2 1)
row 0 - - - - - - 2 1
row 1 6 5 4 3 - - 8 7
row 2 12 11 10 9 - - 14 13
row 3 18 17 16 15 - - 20 19
row 4 24 23 22 21 - - 26 25
row 5 30 29 28 27 - - 32 31
row 6 36 35 34 33 - - - -
Key 1 is the F below the first octave and key 36 the top E; middle C lies between keys 19 and 20. Blank cells are unknown. The game does not wait between reads, so parasitic capacitance may not matter here. Source: NESdev Wiki, Doremikko Keyboard.
Exciting Boxing Punching Bag
A punching bag with eight sensors, used by one game (Exciting Boxing). $4016 write bit 1 (A) chooses which four sensors $4017 returns:
$4017 read: xxxE DCBx
bit 1: Left Hook (A = 0), Left Jab (A = 1)
bit 2: Move Right (A = 0), Body (A = 1)
bit 3: Move Left (A = 0), Right Jab (A = 1)
bit 4: Right Hook (A = 0), Straight (A = 1)
Source: NESdev Wiki, Exciting Boxing Punching Bag.
Jissen Mahjong controller
A 21-button controller for two Capcom games (Ide Yousuke Meijin no Jissen Mahjong and its sequel). The buttons are A to N, Select, Start and the mahjong buttons Kan, Pon, Chii, Riichi and Ron. Write $4016: bit 0 is the strobe and bits 1 and 2 choose a row (bit 1 is row bit 0, bit 2 is row bit 1). Reads return one bit in $4017 bit 1. The row is picked while the strobe is high, then eight bits are read after the strobe falls, as on the standard controller:
row 3: (empty), Ron, Riichi, Chii, Pon, Kan, Start, Select
row 2: H, G, F, E, D, C, B, A
row 1: (empty), (empty), N, M, L, K, J, I
row 0: the bitwise OR of rows 1 and 2
A button returns 1 while it is held. The buttons form a 3 by 8 matrix without diodes, as on the Family BASIC keyboard, so three buttons at once can show a fourth that is not pressed. The serial input of the 4021 shift register is tied to ground, so reads after the eighth return 1 on the console. At least two board revisions exist, with no known difference in behaviour. Source: NESdev Wiki, Jissen Mahjong controller.
Coconuts Japan Pachinko Controller
The CJPC-102, made by Hori: a standard controller with a large spring-loaded analogue dial that turns about 90 degrees. It is used by Pachinko Daisakusen (1 and 2) and Pachio Kun (4 and 5). It plugs into the expansion port. Write $4016 bit 0 to strobe; read $4016 bit 1. The report has 16 bits:
bits 0-7 the standard controller report
bit 8 always 1
bits 9-15 the dial, 7 bits, inverted, high bits first
16 and up always 1
Unlike the Arkanoid controller, the dial converts all the time. A 7-bit counter runs at about 20 kHz and its voltage is compared with the dial’s potentiometer; when the counter voltage passes it, the count is latched. A strobe reports the latched count, so a report always holds one whole conversion. The counter wraps every 128 counts (about 6.4 ms). At rest the value is usually 0 at power-on (a first conversion may give $01 or $02); once the dial has been used the minimum is $03 and the maximum about $72 to $74. A small dead zone surrounds the rest position, and a dial that springs back quickly can leave up to $06 latched, so software should widen the dead zone. Games expect $00 to $63 and clamp larger values; if bit 8 is not 1 they ignore the dial. Inside are two 4021 shift registers, a 4024 counter, a 74HC574 latch and a µPC393 comparator. Source: NESdev Wiki, Coconuts Japan Pachinko Controller.
Bandai Hyper Shot
A machine-gun-shaped lightgun for the Famicom expansion port, packed with Space Shadow. It joins a Zapper and a standard controller, and has a vibration motor and a speaker.
$4016 write: xxxx xABS S (bit 0): strobe B (bit 1): vibration and gun move (1 = on)
A (bit 2): sound (1 = on)
$4016 read: xxxx xxEx the embedded standard controller (joypad 1 /D1)
$4017 read: xxxT Wxxx W (bit 3): light sensed (0 = detected) T (bit 4): trigger (1 = fully pulled)
The A button never registers, although the box says the main trigger is A. The light report equals the Zapper’s, except for the trigger: the Hyper Shot reads 1 when the trigger is fully pulled, which allows continuous fire. A normal Zapper game, which expects the half-pulled change, sees the trigger when it is released. Only the vibration system uses batteries. Source: NESdev Wiki, Bandai Hyper Shot.
Arkanoid II prototype controller
A prototype of Arkanoid II expects a different controller from the production Arkanoid controller; everything here is inferred from the software. The knob data and buttons of both players use other register bits, and the knob value is 8 bits, not 9.
$4016 read: xxxx xxDx player 1 knob: 8 bits, inverted, most significant first, then 1s
$4017 read: xxxB BxDx D (bit 1): player 2 knob bit 3: player 1 fire bit 4: player 2 fire
The production controller wires the least significant bit of its 9-bit value to the shift register input; the prototype seems to tie it to ground, so it reads 1, and the game replaces the knob data by $FF when that bit is not 1 (probably to detect a missing controller). The write interface is not known for certain; it matches the OUT0 strobe of the production controller, and the game also strobes OUT1 afterwards. The value ranges the prototype expects are $26 to $B9 (one player), $4C to $D3 (versus, player 1) and $5D to $E4 (versus, player 2); outside them it clamps. Source: NESdev Wiki, Arkanoid II prototype controller.
Hori Track and three more mice
The wiki lists five mice that work with NES or Famicom software; the SNES mouse is above. The other four:
Hori Track (TRK-7). A Famicom trackball made by Hori, for Big Challenge! Go! Go! Bowling, Moero!! Pro Soccer, Operation Wolf, Putt Putt Golf, Quarter Back Scramble and US Championship V’Ball. Report byte 1 is the embedded standard controller. Byte 2, most significant bit first: bits 7-4 axis 1 and bits 3-0 axis 2, each a signed 4-bit value XORed with $F. Byte 3: bits 7 (rotation mode: 0 R, 1 L), 6 (speed: 0 high, 1 low), 5-4 (ID, 1 or 2 depending on the version; the same place as on the Four Score) and 3-0 (unknown, unused by the games). In mode L, Up on the control pad points up, axis 1 points down and axis 2 points right; in mode R, Up points right, axis 1 points left and axis 2 down. The speed switch changes the values before they reach the console; the rotation switch does not.
Macro Winners (Belsonic) mouse. Shipped with Macro Winners keyboard famiclones and carts (Smart Genius and others). Strobe with $4016 bit 0; read $4017 bit 0, most significant bit first. A 1-byte reply is sent when both axes moved between -1 and 1, otherwise three bytes (strobe three times, eight reads each). One byte: LRXXYY00 with L and R the buttons (1 = pressed; the order is the reverse of the SNES mouse) and XX or YY 0 for none, 1 or 2 for one unit right or down, 3 for one unit left or up. Three bytes: LRSXTY01 (S and T are the X and Y direction bits, 1 = left or up; X and Y bit 4 follow), then --XXXX10 (X bits 3-0) and --YYYY11 (Y bits 3-0). The Mega Book mouse is the same except that the two byte-number bits are in another place (LR00XXYY, LR01SXTY, --10XXXX, --11YYYY).
Subor mouse. Used by Subor’s educational carts and some others. It answers the standard strobe, read from $4016 or $4017 bit 0, with 24 bits (bit 23 first): lrE.UDLR.XXXXXXX.YYYYYYY. The first eight bits are built so that a standard controller looks like a mouse moving one unit, so a pad can move the pointer. L and R are the buttons (1 = pressed); E = 1 means the movement was more than 1 and the X and Y fields (7 bits each, absolute) count; U, D, L and R are the direction bits. GameStar Fun Educator: 32-in-1 recognises buttons only when E is set, so some mice may hold E set always.
Yuxing mouse. A serial mouse on either port with X and Y swapped against the usual serial protocol. It is read by writing 0 then 1 to $4016 (the opposite of a standard controller), and the data is inverted. The reply is three 9-bit packets (start 0, seven data bits, stop 1): 1LRXXYY (marks the first packet; R is 1 for pressed, L is 0 for pressed; X and Y bits 7-6), 0YYYYYY (Y bits 5-0) and 0XXXXXX (X bits 5-0). Source: NESdev Wiki, Mouse, Hori Track, Macro Winners Mouse, Subor Mouse and Yuxing Mouse.
Infrared joypads (famiclone chips)
A few famiclones have an infrared receiver and battery joypads, which can usually be set as player 1 or 2. They use special chips whose protocols do not match each other. The wiki gives the pin-outs only, not the protocols. Pairs of transmitter and receiver chips: UA6580 and UA6581 (Bentech Computer Game Machine, DR Super joypad); FLY046 and FLY047 (Micro Genius IQ1000, TIJ-309 joypad); FLY-826A and FLY-827A (Micro Genius IQ2000, TIJ-325 joypad); RTS703 with the parallel receiver RTS702 or the serial receiver RTS705; a 74126 receiver built into the Gameinis Ping Pong cartridge (the transmitter is believed to be in a racket-shaped pad); and an unnamed 16-pin receiver from a StarFox famiclone. The receivers take OUT0 and the clocks of both joypads and give the data lines of joypad 1 and 2 (the UA6581 even has pins for each player’s inactivity pulse); the transmitters take the buttons, a player switch and, on some, turbo and function inputs. The pin of each signal follows for every chip. Directions are as the wiki draws them from the chip’s point of view (in: a signal goes into the chip; out: it comes out; none: a power pin or a pin with no arrow; a bare question mark means the wiki does not know the pin’s function). A name starting with an exclamation mark is active low. Source: NESdev Wiki, Infrared controllers.
UA6580 transmitter (18 pins) and UA6581 receiver (14 pins)
| Chip | Pin | Signal | Direction |
|---|---|---|---|
| UA6580 | 1 | VCC | none |
| UA6580 | 4 | !P1!/P2 | in |
| UA6580 | 5 | XTAL1 | in |
| UA6580 | 6 | XTAL2 | in |
| UA6580 | 8 | IR | out |
| UA6580 | 9 | GND | none |
| UA6580 | 10 | !B | in |
| UA6580 | 11 | !A | in |
| UA6580 | 12 | !SELECT | in |
| UA6580 | 13 | !START | in |
| UA6580 | 14 | !UP | in |
| UA6580 | 15 | !DOWN | in |
| UA6580 | 16 | !LEFT | in |
| UA6580 | 17 | !RIGHT | in |
| UA6580 | 18 | !LED | out |
| UA6581 | 1 | !RESET? | none |
| UA6581 | 2 | delay? | none |
| UA6581 | 3 | XTAL1 | in |
| UA6581 | 4 | XTAL2 | in |
| UA6581 | 5 | P1_CLK | in |
| UA6581 | 6 | P1_D0 | out |
| UA6581 | 7 | GND | none |
| UA6581 | 8 | IR | in |
| UA6581 | 9 | OUT0 | in |
| UA6581 | 10 | P2_CLK | in |
| UA6581 | 11 | P2_D0 | out |
| UA6581 | 12 | P1 inactivity pulse? | out |
| UA6581 | 13 | P2 inactivity pulse? | out |
| UA6581 | 14 | VCC | out |
Found in the Bentech Computer Game Machine and the DR Super joypad. The wiki draws pin 14 of the receiver with an arrow pointing out, although it is the supply pin.
FLY046 transmitter (20 pins) and FLY047 receiver (14 pins)
| Chip | Pin | Signal | Direction |
|---|---|---|---|
| FLY046 | 1 | !UP | in |
| FLY046 | 2 | !START | in |
| FLY046 | 3 | !SELECT | in |
| FLY046 | 4 | !B | in |
| FLY046 | 5 | !A | in |
| FLY046 | 6 | !TURBO_ON | in |
| FLY046 | 7 | XTAL1 | in |
| FLY046 | 8 | XTAL2 | in |
| FLY046 | 9 | !REDLED | out |
| FLY046 | 10 | GND | none |
| FLY046 | 11 | IR1 | out |
| FLY046 | 12 | IR2 | out |
| FLY046 | 13 | VCC | none |
| FLY046 | 14 | GND | none |
| FLY046 | 15 | !OFF/ON | in |
| FLY046 | 16 | VCC | none |
| FLY046 | 17 | !2P/1P | in |
| FLY046 | 18 | !RIGHT | in |
| FLY046 | 19 | !LEFT | in |
| FLY046 | 20 | !DOWN | in |
| FLY047 | 1 | P1_CLK | in |
| FLY047 | 2 | P2_CLK | in |
| FLY047 | 5 | GND | none |
| FLY047 | 6 | P1_D0 | out |
| FLY047 | 7 | P2_D0 | none |
| FLY047 | 9 | XTAL1 | in |
| FLY047 | 10 | XTAL2 | in |
| FLY047 | 11 | VCC | none |
| FLY047 | 12 | IR | in |
| FLY047 | 13 | OUT0 | in |
Found in the Micro Genius IQ1000 console and the Micro Genius TIJ-309 joypad. The receiver’s pins 3, 4, 8 and 14 have no label on the wiki.
FLY-826A transmitter (20 pins) and FLY-827A receiver (18 pins)
| Chip | Pin | Signal | Direction |
|---|---|---|---|
| FLY-826A | 1 | !REDLED | out |
| FLY-826A | 2 | !SLOW | in |
| FLY-826A | 3 | !LEFT | in |
| FLY-826A | 4 | !UP | in |
| FLY-826A | 5 | !RIGHT | in |
| FLY-826A | 6 | !DOWN | in |
| FLY-826A | 7 | TURBOB | out |
| FLY-826A | 8 | TURBOA | out |
| FLY-826A | 9 | !2P/1P | in |
| FLY-826A | 10 | !FUN | in |
| FLY-826A | 11 | ? | none |
| FLY-826A | 12 | GND | none |
| FLY-826A | 13 | !B | in |
| FLY-826A | 14 | !A | in |
| FLY-826A | 15 | !START | in |
| FLY-826A | 16 | !SELECT | in |
| FLY-826A | 17 | XTAL1 (455 kHz) | none |
| FLY-826A | 18 | XTAL2 | none |
| FLY-826A | 19 | !IR | out |
| FLY-826A | 20 | +5V | none |
| FLY-827A | 1 | IRLED | in |
| FLY-827A | 2 | ? | none |
| FLY-827A | 3 | XTAL1 455k (sine) | in |
| FLY-827A | 4 | XTAL2 455k (sq) | out |
| FLY-827A | 5 | power strobe | out |
| FLY-827A | 6 | P2 D0 | out |
| FLY-827A | 7 | P2 CLK | in |
| FLY-827A | 8 | reset strobe | out |
| FLY-827A | 9 | ? | none |
| FLY-827A | 10 | GND | none |
| FLY-827A | 11 | P1 D0 | out |
| FLY-827A | 12 | OUT0 | in |
| FLY-827A | 13 | P1 CLK | in |
| FLY-827A | 14 | +5V | none |
| FLY-827A | 15 | ? | none |
| FLY-827A | 16 | !RESET | in |
| FLY-827A | 17 | ? | none |
| FLY-827A | 18 | ? | out |
Found in the Micro Genius IQ2000 console and the Micro Genius TIJ-325 joypad.
RTS703 transmitter, RTS702 parallel receiver and RTS705 serial receiver (all 16 pins)
| Chip | Pin | Signal | Direction |
|---|---|---|---|
| RTS703 | 1 | !P2/P1 | in |
| RTS703 | 2 | !UP | in |
| RTS703 | 3 | !DOWN | in |
| RTS703 | 4 | GND | none |
| RTS703 | 5 | !RIGHT | in |
| RTS703 | 6 | !LEFT | in |
| RTS703 | 7 | XTAL1 | in |
| RTS703 | 8 | XTAL2 | in |
| RTS703 | 9 | !START | in |
| RTS703 | 10 | !SELECT | in |
| RTS703 | 11 | !A | in |
| RTS703 | 12 | !B | in |
| RTS703 | 13 | TURBO | out |
| RTS703 | 14 | IR | out |
| RTS703 | 15 | LED | out |
| RTS703 | 16 | VCC | none |
| RTS702 | 1 | RESET | in |
| RTS702 | 2 | ? TEST | none |
| RTS702 | 3 | XTAL1 | in |
| RTS702 | 4 | XTAL2 | in |
| RTS702 | 5 | GND | none |
| RTS702 | 6 | IR | in |
| RTS702 | 7 | VCC | none |
| RTS702 | 8 | LEFT | out |
| RTS702 | 9 | RIGHT | out |
| RTS702 | 10 | P1/P2 | out |
| RTS702 | 11 | DOWN | out |
| RTS702 | 12 | UP | out |
| RTS702 | 13 | START | out |
| RTS702 | 14 | SELECT | out |
| RTS702 | 15 | A | out |
| RTS702 | 16 | B | out |
| RTS705 | 1 | P2_CLK | in |
| RTS705 | 2 | XTAL1 | in |
| RTS705 | 3 | XTAL2 | in |
| RTS705 | 7 | IR | in |
| RTS705 | 8 | +4.3V | in |
| RTS705 | 9 | OUT0 | in |
| RTS705 | 11 | GND | none |
| RTS705 | 12 | P1_D0 | out |
| RTS705 | 13 | P2_D0 | out |
| RTS705 | 15 | LED | out |
| RTS705 | 16 | P1_CLK | in |
The wiki says that RTS705 pins 4, 5, 6, 10 and 14 have no internal connection (checked with a multimeter diode test against VCC and GND).
Two receivers without a chip name
The receiver of the Gameinis Ping Pong cartridge is built from a 74126 and an unnamed part; the wiki gives no pins for it. The unnamed 16-pin DIP receiver from a StarFox famiclone is drawn this way (the arrows are the wiki’s; a receiver would normally drive the two D0 lines, so they may be drawn the wrong way round):
| Pin | Signal | Direction |
|---|---|---|
| 1 | P2? LED | out |
| 2 | GND | none |
| 4 | XTAL1 | in |
| 5 | XTAL2 | in |
| 6 | VCC | none |
| 7 | IR | in |
| 8 | $4017 clk | in |
| 9 | OUT0 | in |
| 10 | OUT0 | in |
| 11 | $4016 clk | in |
| 14 | $4016 D0 | in |
| 15 | P1? LED | out |
| 16 | $4017 D0 | in |
Further reading, as the wiki lists it: forum threads about each chip family (the Bentech, Micro Genius, RTS70x, Gameinis and StarFox parts). The wiki’s page has no protocol for any of them.
Famicom 3D System
An expansion-port device with active LCD shutter glasses. The headset (HVC-031) plugs into a control box (HVC-032) through a 3.5 mm jack; the box has two such ports and passes the expansion port through. Games choose which eye sees each frame, giving a 30 Hz stereoscopic picture (so each image flickers at 30 Hz); the glasses need low latency and an impulse display. Output is one bit:
$4016 write: xxxx xxFx F (bit 1): 0 = the next video field is for the left eye (left lens clear, right opaque)
1 = the next field is for the right eye
Eight Famicom games support it (Attack Animal Gakuen, Cosmic Epsilon, Falsion, Famicom Grand Prix II: 3D Hot Rally, Fuuun Shourin Ken: Ankoku no Maou, Highway Star, JJ: Tobidase Daisakusen Part II and Tobidase Daisakusen). The Select button switches 3D on, except in Fuuun Shourin Ken, where A held with Start on the title screen does it. It was sold only in Japan; the international 3-D WorldRunner and Rad Racer use red and cyan anaglyph glasses instead. The signal is the same as Sega’s Master System 3D: tip to sleeve is the left eye and ring to sleeve the right eye, and the glasses want 10 V peak (20 V peak to peak) to turn an eye opaque and 0 V to make it clear, with no DC component, which would damage the crystals. The box holds a JRC4558 dual op-amp and a Sharp IX0043AE logic chip that makes a clock for the 10 V and -10 V; its details are not known. Source: NESdev Wiki, Famicom 3D System (the 3D glasses title redirects to it).
R.O.B.
The Robotic Operating Buddy (Family Computer Robot in Japan) is a toy robot used by two games, Gyromite and Stack-Up. It has light sensors, like the Zapper’s, and receives commands as screen flashes, one bit per vertical sync. Black is 0 (official games use palette entry $0F) and a bright colour is 1 ($2A green). A command takes 13 bits, or perhaps 14 (if Z is 1 the next bit must be 0):
000101w1x1y1z wxyz: 0101 up 2 steps 1100 up 1 step 0010 down 1 step
1101 down 2 steps 0100 body left 1000 body right
0110 close the arms 1010 open the arms
1001 head LED on permanently
0001 reset: LED off, arms open, seek rightmost and upmost, then back to the centre
The other six values do nothing. A steady stream of flashes at 25 or 30 Hz makes the LED blink while R.O.B. sees the screen, which helps to aim its head. Its field of view is not known. Source: NESdev Wiki, R.O.B.; the firmware is described below from the wiki’s R.O.B. Firmware page.
R.O.B. firmware
The wiki’s R.O.B. Firmware page is a commented disassembly by nocash (2019) of the robot’s microcontroller, made from a dump by Sean Riddle. The part is a Nintendo RFC-CPU10 in a 16-pin package, which is a Sharp SM590 4-bit microcontroller, on a mainboard marked (C)1985 Nintendo, RFC-03-CPU. Around it are three Sharp IR2C25 8-pin motor drivers, a 455 kHz CSB455 resonator, a power switch and four AA cells. The head has a daughterboard with a Sharp IR3T07 9-pin chip, a 43PI light sensor and an LED on a small separate board. There are three motors, each able to run forwards, backwards or stop and each driving a gear train of five big and small wheels: left and right in the base, up and down and open and close in the shoulders. The up/down and left/right motors have switches that sense the notches (six up and down, five left and right); the open and close motor has no feedback.
Ports
| Port bit | Direction | Use |
|---|---|---|
| PORT[0].0 | in | light sensor |
| PORT[0].1 | in | notch switch for the five left and right positions |
| PORT[0].2 | in | notch switch for the six up and down positions |
| PORT[0].3 | out | LED |
| PORT[1].0 | out | move down |
| PORT[1].1 | out | move up |
| PORT[1].2 | out | arm close |
| PORT[1].3 | out | arm open |
| PORT[2].0 | out | rotate right |
| PORT[2].1 | out | rotate left |
| PORT[2].2, PORT[2].3 | unused | bit 3 has no external pin on the 16-pin part (only the 18- and 20-pin parts) |
| PORT[3].0 | out | debug (no external pin on the 16-pin part) |
| PORT[3].1 | out | debug (20-pin part only) |
| PORT[3].2 | unused | no external pin on the 16-pin part |
| PORT[3].3 | clock? | the wiki marks it with a question mark |
RAM
The RAM is 4-bit wide nibbles at addresses 00h to 1Fh. 00h, 01h and 02h hold the command being received (most significant, middle and least significant nibble); 03h and 04h are delay counters; 0Ah is the “another step” flag (0 none, 1 down, 2 up); 0Bh is an off-hold counter for the LED; 0Dh bit 0 is the LED flag (bit 1 is another flag that is not really used); 0Eh and 0Fh are the off-hold counter of the LED-blink test command; 1Ch counts the calibration steps, 1Dh counts movement and grabbing loops, and 1Eh and 1Fh are loop counters. The other nibbles are unused.
Start-up and command reading
The reset entry is at 0000h, the standby entry at 0001h (it clears 32 RAM nibbles) and the soft reset at 0008h (it clears ports 2, 1 and 0). After that the firmware rotates to the right four steps with the arm held up and open, until four horizontal notches are hit, then two steps to the left, which centres the body, then moves up until the top notch is sensed, and turns the LED on if the LED flag is set. The main loop clears the 12-bit command buffer to all ones and then reads one bit at a time: it samples the light sensor for a short timed window; a flash counts as a 1 (the firmware then waits for the screen to go dark again and for a further delay) and no flash as a 0; each bit is shifted into the three-nibble buffer from the right. After every bit it compares the buffer with the known commands. The commands the firmware recognises are the 12 bits that follow the first bit of the 13-bit message described above (our reading; it matches every row of the table):
| wxyz | 12-bit pattern in the firmware | Firmware label | Command above |
|---|---|---|---|
| 0001 | 0010 1010 1011 | reset | reset |
| 0010 | 0010 1010 1110 | down small step | down 1 step |
| 0100 | 0010 1011 1010 | turn left | body left |
| 0101 | 0010 1011 1011 | up large step | up 2 steps |
| 0110 | 0010 1011 1110 | close arms | close the arms |
| 1000 | 0010 1110 1010 | turn right | body right |
| 1001 | 0010 1110 1011 | turn LED on permanently | head LED on |
| 1010 | 0010 1110 1110 | open arms | open the arms |
| 1100 | 0010 1111 1010 | up small step | up 1 step |
| 1101 | 0010 1111 1011 | down large step | down 2 steps |
The disassembly marks the patterns 0010 1010 1010 and 0010 1111 1110 as doing nothing (wxyz 0000 and 1110). After a recognised command the firmware sets the LED briefly and goes back to waiting for a fresh command; the page also lists the helper routines for moving the arm, closing and opening it, stopping all motors and the long delays, and the unused vectors at 0080h and 0082h. The full listing, with the machine code and cycle counts of every instruction, is on the wiki; it is not copied here.
Battle Box
A Famicom expansion-port device with 512 bytes of EEPROM in two TC89102 chips, each 7 address bits and 16 data bits; the chips are like microwire parts, except that the address goes in before the command. Games: Battle Stadium - Senbatsu Pro Yakyuu (1 team slot), Armadillo (4 save slots), J-League Fighting Soccer (2 team slots) and Seiryaku Simulation - Inbou no Wakusei - Shancara (1 auto-save slot). Interface: $4016 write bit 0 is the clock line of both chips. $4017 read gives bit 3 (W) the data line and bit 4 (R) the data read from the chip, inverted. The data line toggles after every read, so the value you get is the opposite of the last one; to set the output you read until it is the opposite of what you want. If bit 0 of $4016 is high during a read of $4017, the read also toggles which of the two chips is enabled. Source: NESdev Wiki, Battle Box.
TV-NET controllers and the FAM-NET keyboard
TV-NET controller. An expansion-port device for the TV-NET MC-1200 modem software, in at least four versions that differ only in button labels; 21 buttons and a pulse or touch-tone (P/T) switch. Strobe with $4016 bit 0 and read $4016 bit 1. A 24-bit report arrives over 24 reads, then 1s. For the TV-NET version: 0 P/T switch (1 = tone), 1 End, 2 F3, 3 always 1, 4 F1, 5 F2, 6 F4, 7 F5, 8 1, 9 4, 10 7, 11 always 1, 12 2, 13 3, 14 5, 15 6, 16 *, 17 Left, 18 Run, 19 Right, 20 8, 21 9, 22 0, 23 the dot. The Piste, Nikko no Home Trade One and Daiwa or Universal no My Trade versions relabel some of these: for example bit 2 is Memory, Account entry or Previous page, and bit 16 is Up on the Piste.
TV-NET Rank 2 controller. For the TV-NET Rank 2 MC-4800 modem. It is compatible with the TV-NET report and adds eight buttons in a 32-bit report: bits 0 to 23 as above (with extra labels such as F6 to F8 and Backspace), 24 Input, 25 Up, 26 Down, 27 Character, 28 Function, 29 Exchange, 30 Resend, 31 Stop again. It can be used with the TV-NET MCP-24 printer through a multi-port adapter.
FAM-NET keyboard. A cut-down Family BASIC keyboard with 16 keys and no data recorder support, otherwise the same. It maps LINE to F1, the left arrow to the left arrow, the bullet to the dot, EB to F7, the digits to themselves, * to SPACE and # to RETURN. Both FAM-NET modems came with one; they are believed to be the same. Source: NESdev Wiki, TV-NET controller, TV-NET Rank 2 controller and FAM-NET Keyboard.
Family Computer Network Adapter (HVC-035)
An unreleased Famicom modem used with the Disk System through the RAM adapter’s expansion port. It also provides kanji graphics, as the later Network System does, and has a speaker. The expansion port is read at $4033 and written at $4026 (the low seven bits), and each side can pull a bit low, so to receive on a bit the console must first set it.
bit 6 P packet available (0 = available)
bit 5 D packet data
bit 4 C console ready (0 = ready) and the console’s packet clock
bit 3 A adapter ready (0 = ready) and the adapter’s packet clock
bit 2 R kanji or controller read clock
bit 1 W kanji index write clock, and read selector (0 = kanji, 1 = controller)
bit 0 K kanji or controller data
Bits changed in the same step must be written together. Kanji. The adapter holds 4096 characters of 16 by 16 pixels, one bit per pixel (32 bytes, ordered top left, bottom left, top right, bottom right). To write the 12-bit index: set bit 2 and clear bit 1; write an index bit (low first) to bit 0; set bit 1; clear bit 1; repeat from the second step until all 12 bits are in. To read the 32 bytes: set bit 0, clear bit 2, read a data bit from bit 0 (low first), set bit 2, repeat from the clear until all are read. Software converts Shift-JIS in $8000-$9FFF and $E000-$EBFF to indices, and the first half (128 KiB) of the Network System’s kanji ROM seems compatible.
Controller. A 23-button controller with a D-pad and number pad attaches directly to the adapter (coiled cable). It is laid out like the Network Controller but has no A, B, Select or Start, and its report differs. To read it: set bit 2, clear bit 1, set bit 0; set bit 1; clear bit 2; read a bit from bit 0; set bit 2; repeat from the clear until 24 bits are read. The report: 0 Previous page, 1 Next page, 2 1, 3 2, 4 3, 5 *, 6 C, 7 End communication, 8 Up, 9 Right, 10 4, 11 5, 12 6, 13 #, 14 the dot, 15 Table of contents, 16 Left, 17 Down, 18 7, 19 8, 20 9, 21 0, 22 Execute, 23 always 0. What is returned after 24 reads is not known; software ignores the input when two or more buttons are down, unless only D-pad directions are.
Packets. Data moves in packets ended by the byte $1F, in batches of up to 20 bytes per frame. To send: check bits 6 and 3 are set (if not, receive the pending packet instead); clear bit 4; check again (else set bit 4 and receive); clear bit 6; wait for bit 3 to toggle (fail if it does not in time); then, for each bit, toggle bit 4 and write the data bit (low first) to bit 5, until a $1F has been sent; wait for bit 3 to clear; set bits 6, 5 and 4; wait for bit 3 to set. To receive (the adapter is ready when bits 6 and 4 are both 0): clear bit 4; wait for bit 3 to toggle (fail if bit 6 sets or time runs out); read a data bit (low first) from bit 5; toggle bit 4; repeat until a $1F has been read; wait for bits 6 and 3 to be set; set bit 4. After any failure the console sets bit 4 (receive) or bits 6, 5 and 4 (send). The packet contents are not understood. Source: NESdev Wiki, Family Computer Network Adapter.
Super Famicom NTT Data Keypad
The NDK10 adds 15 buttons to a SNES-style controller, for the Super Famicom NTT Data Communication Modem. Its report is 32 bits: bits 0 to 15 are the SNES report with a different signature, and bits 16 to 31 are the last sixteen bits of the Famicom Network Controller report.
0 B 1 Y 2 Previous page 3 Next page 4 Up 5 Down 6 Left 7 Right 8 A 9 X 10 L 11 R
12 always 0 13 always 1 14 always 0 15 always 0
16-25 the keys 0 to 9 26 * 27 # 28 the dot 29 C 30 always 0 31 End communication
32 and up: always 1
Source: NESdev Wiki, Super Famicom NTT Data Keypad.
Namco Serial Checker Interface and Namco IPL Interface
Serial Checker. A development interface on the Famicom expansion port that was never sold; the page is built from disassembled games. Games send bytes and read them back to decide whether to run the cartridge self-test at power-on or reset. Write $4016 bit 0 (data in); read $4017 bit 3 (data out). It acts like a 4-bit shift register: what is sent shows at the output after four reads, inverted. A game fetches a source byte, then twelve times (4 dummy bits and 8 data bits) reads $4017 bit 3 into the target and shifts a source bit out to $4016; the target must equal the source XOR $FF; if every byte passes, the self-test (a partial PRG and CHR checksum) runs. The source is usually a 32 or 64-byte string of credits. A variant used by Family Circuit ’91 and the unreleased Splatterworld to check or initialise battery SRAM uses $4017 bit 1 instead and is the same as joining OUT0 to joypad 2 /D1.
IPL Interface. Lets Disk System games made by Namco load data into PRG RAM and the nametables, with an option to save to disk, through a program (IPL.MAIN) on the disk. Write $4016 bit 0 (a strobe, done once at start-up); read $4017: bits 1 and 2 and bit 4 data, bit 3 status. The IPL checks that the interface exists by reading the status bit before and after the strobe: if it changes, a transfer starts; otherwise it shows a fake licence screen and boots the game. The IPL masks the read with %00010110 and tests any bit; whether the data bits are identical is not known. The protocol looks like inverted RS-232 at 38400 baud: a start bit (0), eight data bits (least significant first) and a stop bit (1); the IPL waits 47 cycles per bit and 62 cycles from the edge before sampling. The data is a variant of Intel HEX: : then ASCII-hex fields, length, address (big endian), record type (00), data, checksum complement. A length of 0 ends the transfer after ten more raw bytes. An address below $6000 has $2000 added and goes to the PPU, otherwise it goes to PRG RAM. The checksum over the decoded bytes, with carry clear, must reach 0. Source: NESdev Wiki, Namco Serial Checker Interface and Namco IPL Interface.
Sunsoft Disk Control Interface
A developer interface (never sold) for the Disk Control Program in Sunsoft’s developer disk lot, which moved data to and from the Disk System to manage files. The page is from disassembled code, and its RS-232 signals are named as seen from the device that sends to the FDS. $4016 bit 1 is RTS (read-only) and bit 2 is RxD or CTS (write-only); $4017 bits 4-1 are four bits of parallel TxD data. Receiving a byte: wait for RTS set; set CTS and wait for RTS clear; read the four TxD bits into the upper nibble; clear CTS and wait for RTS set; set CTS and wait for RTS clear; read the four bits into the lower nibble; XOR the byte with $FF; clear CTS. Sending a byte: delay briefly; write a start bit to RxD; for each of eight bits, wait for RTS set, then write the inverted bit (least significant first) and wait for RTS clear; wait for RTS set; write the stop bit and wait for RTS clear. Packets start with a mode byte (modes above 2 are ignored): mode 0 receives data ($00, length, destination address, data); mode 1 transmits ($01, length, source address, then the data goes back); mode 2 receives packets until a length of 0. Addresses are big endian, and a length of 0 means 256 except in mode 2. Source: NESdev Wiki, Sunsoft Disk Control Interface.
Port test controller
A factory test device with two standard controllers and a fixed signature on D3 and D4 of both joypads (the NES-INP-01 board), plugged into both ports through one two-plug connector like the Four Score. Strobe with $4016 bit 0 as usual. Reads of $4016 and $4017 give the standard report in bit 0, a signature in bit 3 and bit 4. Each joypad has one shift register; D4 reads its last bit and D3 a tap six bits in, so D3 skips two bits and shows what D4 will show two reads later. The joypad 1 signature is 1 0 1 0 1 0 1 0 then 1s; the joypad 2 signature is 0 1 0 1 0 1 0 1 then 0s. Source: NESdev Wiki, Port test controller.
Not covered on this page
Every device on the wiki’s “Input devices” page that has a page on the wiki is now written here or on the Four Score section above: the standard controller, Four Score and the Hori 4 Players Adapter (one section of the Four player adapters page), Zapper, Power Pad, Arkanoid controller and its prototype, Bandai Hyper Shot, Coconuts Pachinko, Doremikko Keyboard, Exciting Boxing Punching Bag, Family BASIC Keyboard, Jissen Mahjong controller, Konami Hyper Shot, Miracle Piano, the mice (Super NES Mouse, Hori Track, Macro Winners, Subor, Yuxing), Oeka Kids tablet, Partytap, SNES controller, Virtual Boy controller, the infrared joypads, Famicom 3D System, Family BASIC Data Recorder, R.O.B., Battle Box, Turbo File, Barcode Battler, TV-NET and TV-NET Rank 2 controllers, FAM-NET Keyboard, Family Computer Network Adapter, Famicom Network Controller, Super Famicom NTT Data Keypad, the Namco Serial Checker and IPL interfaces, the Sunsoft Disk Control Interface and the port test controller. Not written, and why: Power Glove, U-Force, RacerMate Bicycle and Top Rider Bike are linked from the Input devices page but their pages do not exist on the wiki (the raw request returned “not found” on 2026-11-19), so there is nothing to summarise; the pin tables of the infrared chips and the R.O.B. firmware (ports, RAM, start-up, command reading and the command patterns) are now written above, but the R.O.B. firmware’s full instruction listing (machine code and cycle counts) and the Zapper’s and mouse’s code listings are on the wiki and are not copied here; the Famicom Network System has its own page (Famicom Network System). The table of pins above gives the port usage of the devices as the wiki’s table does. The full list of games per adapter is on the wiki.
Sources
- NESdev Wiki: Controller reading (the “Controller port registers” page redirects here)
- NESdev Wiki: Controller reading code
- NESdev Wiki: Standard controller
- NESdev Wiki: Controller port pinout
- NESdev Wiki: Expansion port
- NESdev Wiki: Four player adapters
- NESdev Wiki: Zapper
- NESdev Wiki: Power Pad
- NESdev Wiki: Arkanoid controller
- NESdev Wiki: Input devices
- NESdev Wiki: Family BASIC Keyboard
- NESdev Wiki: Family BASIC Data Recorder
- NESdev Wiki: Famicom Network Controller
- NESdev Wiki: Super NES Mouse
- NESdev Wiki: Konami Hyper Shot
- NESdev Wiki: Oeka Kids tablet
- NESdev Wiki: Miracle Piano
- NESdev Wiki: Turbo File
- NESdev Wiki: Barcode Battler
- NESdev Wiki: SNES controller
- NESdev Wiki: Virtual Boy controller
- NESdev Wiki: Partytap
- NESdev Wiki: Doremikko Keyboard
- NESdev Wiki: Exciting Boxing Punching Bag
- NESdev Wiki: Jissen Mahjong controller
- NESdev Wiki: Coconuts Japan Pachinko Controller
- NESdev Wiki: Bandai Hyper Shot
- NESdev Wiki: Arkanoid II prototype controller
- NESdev Wiki: Mouse, Hori Track, Macro Winners Mouse, Subor Mouse, Yuxing Mouse
- NESdev Wiki: Infrared controllers
- NESdev Wiki: Famicom 3D System
- NESdev Wiki: R.O.B.
- NESdev Wiki: R.O.B. Firmware
- NESdev Wiki: Battle Box
- NESdev Wiki: TV-NET controller, TV-NET Rank 2 controller, FAM-NET Keyboard
- NESdev Wiki: Family Computer Network Adapter
- NESdev Wiki: Super Famicom NTT Data Keypad
- NESdev Wiki: Namco Serial Checker Interface, Namco IPL Interface
- NESdev Wiki: Sunsoft Disk Control Interface
- NESdev Wiki: Port test controller
The NESdev Wiki text is available under CC BY-SA 3.0. This page is written in our own words from the raw wikitext kept in samples/nes/sources/hardware; the code is the wiki’s example, shortened.