Skip to main content
NESdev Wiki
Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

Input devices

The NES has two general-purpose controller ports on the front of the console, as well as a (rarely used) 48-pin expansion port underneath.

The Famicom’s standard controllers are hardwired to the front of the unit, and a special 15-pin expansion port is commonly used for third-party controllers. The AV Famicom, however, features detachable controllers using the same ports as the NES.

The NES and Famicom have a set of I/O ports used for controllers and other peripherals, consisting of the following:

  • One output port, 3 bits wide, accessible by writing the bottom 3 bits of $4016.
    • The values latched by $4016/write appear on the OUT0-OUT2 output pins of the 2A03/07, where OUT0 is routed to the controller ports and OUT0-OUT2 to the expansion port on the NES.
  • Two input ports, each 5 bits wide, accessible by reading the bottom 5 bits of $4016 and $4017. Reading $4016 and $4017 activates the /OE1 and /OE2 signals, respectively, which are routed to the controller ports and the expansion port.
    • On the NES, only D0, D3, and D4 are connected to both controller ports, while all of D0-D4 are connected to the expansion port.
    • On the original Famicom, the two ports differ: $4016 D0 and D2 and $4017 D0 are permanently connected to both controllers, while $4016 D1 and all of $4017’s D0-D4 are connected to the expansion port.
    • On the AV Famicom, only D0 is connected to the controller ports. The expansion port is unchanged.

Programmer’s reference

Hardware

Other I/O devices

Usage of port pins by hardware type

typeoutputJoypad 1Joypad 2audio output
signalOUT2OUT1OUT0/OE1D4D3D2D1D0/OE2D4D3D2D1D0AUDIO
access methodwrite $4016[1]read $4016[2]read $4017
available on these ports
Controller port 1 (AV Famicom)OUT0/OE1D0
Controller port 1 (Famicom (internal))OUT0/OE1D0
Controller port 1 (NES)OUT0/OE1D4D3D0
Controller port 2 (AV Famicom)OUT0/OE2D0
Controller port 2 (Famicom (internal))OUT0D2/OE2D0
Controller port 2 (NES)OUT0/OE2D4D3D0
Expansion port (Famicom)OUT2OUT1OUT0/OE1D1/OE2D4D3D2D1D0AUDIO
Expansion port (NES)OUT2OUT1OUT0/OE1D4D3D2D1D0/OE2D4D3D2D1D0AUDIO
used by these devices
Controller (port 1)[3]OUT0/OE1D0
Controller (port 2)[3]OUT0/OE2D0
Controller (Famicom controller 2)[4]OUT0D2/OE2D0
Controller (expansion port)OUT0/OE1D1AUDIO[5]
Arkanoid controller (port 2)[3]OUT0/OE2D4D3
Arkanoid controller (expansion port)OUT0D1/OE2D1
Arkanoid II controller (2 controllers)OUT0D1/OE2D4D3D1
Bandai Hyper ShotOUT2OUT1OUT0/OE1D1D4D3AUDIO
Exciting Boxing Punching BagOUT1D4D3D2D1
FAM-NET KeyboardOUT2OUT1OUT0D4D3D2D1
Family Trainer MatOUT2OUT1OUT0D4D3D2D1
Family BASIC KeyboardOUT2OUT1OUT0D4D3D2D1
Famicom 3D SystemOUT1
Famicom Network System controllerOUT0/OE1D1
Four player adapter (Four Score)OUT0/OE1D0/OE2D0
Four player adapter (Hori 4 Players Adapter)OUT0/OE1D1/OE2D1
Hori TrackOUT0/OE2D1
Jissen Mahjong controllerOUT2OUT1OUT0/OE2D1
Konami Hyper ShotOUT2OUT1D4D3D2D1
Oeka Kids tabletOUT1OUT0D3D2
Pachinko controllerOUT0/OE1D1
Party TapOUT0/OE2D4D3D2
Pokkun Moguraa Tap-tap MatOUT2OUT1OUT0D4D3D2D1
Power Pad (port 2)[3]OUT0/OE2D4D3
Port test controllerOUT0/OE1D4D3D0/OE2D4D3D0
TV-NET controllerOUT0/OE1D1
TV-NET Rank 2 controllerOUT0/OE1D1
Zapper (port 2)D4D3
Zapper (expansion port)D4D3[6]
Zapper (Vs. System) (port 1)[3]OUT0/OE1D0
  1. ↑ /OE1 is activated by reading $4016.
  2. ↑ /OE2 is activated by reading $4017.
  3. ↑ 3.0 3.1 3.2 3.3 3.4 Controllers using NES ports can be plugged into either port, using that port’s /OE and data lines. However, games may expect a controller to only be in a specific port.
  4. ↑ The Famicom controller 2 has a microphone that sends audio input over $4016 D2. This is not affected by OUT0 nor /OE2.
  5. ↑ A Famicom expansion controller may connect the audio output signal to a headphone jack (for example: IQ502 joypad).
  6. ↑ The Casel Zapper plays audio when the trigger is pulled, but this is done entirely by the controller independent of the console’s audio out.

Edit this page on GitHub