Input devices: Difference between revisions

From NESdev Wiki
Jump to navigationJump to search
(+ Famicom 3D glassess, removed +5V/GND from all rows, reformatted table)
Line 10: Line 10:
** 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 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.
** On the AV Famicom, only D0 is connected to the controller ports. The expansion port is unchanged.
=== Programmer's reference ===
== Programmer's reference ==
* [[Controller reading]]
* [[Controller reading]]


=== Hardware ===
== Hardware ==
* [[Controller port pinout]]
* [[Controller port pinout]]
* Controllers
* Controllers
Line 42: Line 42:
* [[Infrared controllers]]
* [[Infrared controllers]]


=== Other I/O devices ===
== Other I/O devices ==
* [[Famicom 3D glasses]]
* [[Famicom 3D glasses]]
* [[Family BASIC Data Recorder]]
* [[Family BASIC Data Recorder]]
Line 50: Line 50:
* [[Barcode Battler]]
* [[Barcode Battler]]


=== Usage of port pins by hardware type ===
== Usage of port pins by hardware type ==
{| class="wikitable"
{| class="wikitable"
!Device                       
!Device                       
Line 70: Line 70:
!/IRQ
!/IRQ
! AUDIO
! AUDIO
! +5V
! GND
! Note
! Note


|-
|-
<!-- Device                                             !! $4016 D4 !! $4016 D3 !! $4016 D2 !! $4016 D1 !! $4016 D0 !! $4016 CLK !! $4017 D4 !! !4017 D3 !! 4017 D2 !! $4017 D1 !! $4017 D0 !! $4017 CLK !!OUT2 !!OUT1 !!OUT0 !!/IRQ !! AUDIO !! +5V !! GND  !! Note-->
<!-- Device                                                           !!4!!3!!2!!1!!0!!C!!4!!3!!2!!1!!0!!C!!2!!1!!0!!I!!A!! Note-->
| [[Controller port pinout|Joypad1]]<br/>(NES Four Score Joypad 1 & 3)                     ||         ||         ||         ||         || x       || x         ||         ||         ||         ||         ||         ||           ||     ||     || x   ||     ||       || x    || x    ||rowspan=4|*AUDIO line can be used for pad which has audio jack to plug in headphones (for example: IQ502 joypad)<br/>*$4016 D2 can be uses as microphone input
|[[Controller port pinout|Joypad1]]<br/>(NES Four Score Joypad 1 & 3) || || || || ||x||x|| || || || || || || || ||x|| || ||rowspan=4|<ref>AUDIO line can be used for pad which has audio jack to plug in headphones (for example: IQ502 joypad)</ref><ref>$4016 D2 can be uses as microphone input</ref>
|-                                                                                                                              
|-  
| [[Controller port pinout|Joypad2]]<br/>(NES Four Score Joypad 2 & 4)                     ||         ||         || x       ||         ||         ||           ||         ||         ||         ||         || x       || x         ||     ||     || x   ||    ||      || x    || x   
|[[Controller port pinout|Joypad2]]<br/>(NES Four Score Joypad 2 & 4) || || ||x|| || || || || || || ||x||x|| || ||x|| ||  
|-                                                                                                                              
|-  
| [[Controller port pinout|Joypad3]]<br/>(Famicom)       ||          ||          ||          || x        ||          || x        ||          ||          ||        ||          ||          ||          ||    ||    || x  ||    ||      || x    || x   
|[[Controller port pinout|Joypad3]]<br/>(Famicom)                     || || || ||x|| ||x|| || || || || || || || ||x|| ||  
|-                                                                                                                         
|  [[Controller port pinout|Joypad4]]<br/>(Famicom)      ||          ||          ||          ||          ||          ||           ||         ||         ||        || x       ||          || x        ||    ||    || x  ||    ||      || x    || x   
|-                                                                                                                         
|  Lightgun [[Zapper]]<br/>(NES P2/Famicom)              ||         ||          ||          ||          ||          ||          || x        || x       ||        ||         ||         ||           ||     ||     ||     ||     ||       || x   || x    ||rowspan=2|*AUDIO line can be used for emiting bullet shoot sounds (for example: Casel Zapper)
|-                                                                                                               
|  Lightgun [[Zapper]]<br/>(NES P1)                      || x        || x        ||          ||          ||          ||          ||          ||          ||        ||          ||          ||          ||    ||    ||    ||    ||      || x    || x   
|-
|-
| [[Family BASIC Keyboard]]/Subor Keyboard              ||         ||         ||         ||         ||         ||           || x       || x       || x       || x       ||         ||           || x   || x   || x   ||     ||       || x   || x    
|[[Controller port pinout|Joypad4]]<br/>(Famicom)                    || || || || || || || || || ||x|| ||x|| || ||x|| ||
|-                                                                                                              
|-                                                                   
| [[Arkanoid controller]]<br/>(NES P2)                       ||         ||         ||         ||         || x         ||         || x       || x       ||          ||          ||           ||     ||     ||     ||     ||     ||       || x    || x   
|Lightgun [[Zapper]]<br/>(NES P2/Famicom)                            || || || || || || ||x||x|| || || || || || || || || ||rowspan=2|<ref>AUDIO line can be used for emiting bullet shoot sounds (for example: Casel Zapper)</ref>
|-                                                                                                              
|-                                                                   
| [[Arkanoid controller]]<br/>(Famicom)                       ||         ||         ||         || x       ||           ||         ||         ||         ||         || x       ||          ||     ||     ||     ||     ||     ||       || x    || x   
|Lightgun [[Zapper]]<br/>(NES P1)                                    ||x||x|| || || || || || || || || || || || || || ||
|-                                                                                                              
|-                                                                   
| Exercise Mat [[Power Pad]]<br/>(NES P2)                       ||         ||         ||         ||         || x         ||         || x       || x       ||         ||         ||           ||     ||     ||     ||     ||     ||      || x    || x   
|[[Family BASIC Keyboard]]/Subor Keyboard                            || || || || || || ||x||x||x||x|| || ||x||x||x|| ||
|-                                                                                                              
|-                                                                    
| Exercise Mat [[Power Pad]]<br/>(Famicom)                       ||         ||         || x         || x       || x         ||         || x       || x       || x         || x         ||           ||     ||     ||     ||     ||     ||       || x   || x   
|[[Arkanoid controller]]<br/>(NES P2)                                 || || || || ||x|| ||x||x|| || || || || || || || ||  
 
|-                                                                    
 
|[[Arkanoid controller]]<br/>(Famicom)                               || || || ||x|| || || || || ||x|| || || || || || ||  
|-                                                                    
|Exercise Mat [[Power Pad]]<br/>(NES P2)                             || || || || ||x|| ||x||x|| || || || || || || || ||  
|-                                                                  
|Exercise Mat [[Power Pad]]<br/>(Famicom)                             || || ||x||x||x|| ||x||x||x||x|| || || || || || ||  
|-                                                                   
|[[Famicom 3D glasses]]                                              || || || || || || || || || || || || || ||x|| || ||
|}


|}
<references/>

Revision as of 08:06, 13 May 2020

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

Device $4016
D4
$4016
D3
$4016
D2
$4016
D1
$4016
D0
$4016
CLK
$4017
D4
$4017
D3
$4017
D2
$4017
D1
$4017
D0
$4017
CLK
OUT2 OUT1 OUT0 /IRQ AUDIO Note
Joypad1
(NES Four Score Joypad 1 & 3)
x x x [1][2]
Joypad2
(NES Four Score Joypad 2 & 4)
x x x x
Joypad3
(Famicom)
x x x
Joypad4
(Famicom)
x x x
Lightgun Zapper
(NES P2/Famicom)
x x [3]
Lightgun Zapper
(NES P1)
x x
Family BASIC Keyboard/Subor Keyboard x x x x x x x
Arkanoid controller
(NES P2)
x x x
Arkanoid controller
(Famicom)
x x
Exercise Mat Power Pad
(NES P2)
x x x
Exercise Mat Power Pad
(Famicom)
x x x x x x x
Famicom 3D glasses x
  1. AUDIO line can be used for pad which has audio jack to plug in headphones (for example: IQ502 joypad)
  2. $4016 D2 can be uses as microphone input
  3. AUDIO line can be used for emiting bullet shoot sounds (for example: Casel Zapper)