The RS-232 serial protocol allows two devices to communicate over just a few wires. This page describes a serial cable connection scheme for the NES and Famicom that can use the second controller port or expansion port. See cable construction for instructions on constructing a cable.
Each of the two serial signals may be connected to any one of the listed pins.
Serial | NES controller #2 | NES/Famicom expansion port |
---|---|---|
TX | D0 (data) or D4 | second controller D1 or D4 |
RX & /CTS | OUT0 (strobe) | OUT0 |
TX, RX, and /CTS are TTL-level signals, not RS-232-level signals. TX and RX use +5V for Mark, 0V for Space. Do not connect the NES directly to RS-232; see cable construction for proper connection.
A one-way cable connects TX to the second controller D0, D1, or D4. On the NES, D0 and D4 are available on the second controller port. On the NES and Famicom, second controller D1 and D4 are available on the expansion port.
Any other devices connected to D2 and D3 must not change state while serial data is being read. Any other devices connected to D0, D1, or D4 must drive the line high whenever OUT0 is high, as is done when nothing is connected or a controller/Zapper is connected and no buttons are being held.
A two-way cable additionally connects OUT0 to RX & /CTS. On the NES, OUT0 (strobe) is available on the second controller port. On the NES and Famicom, OUT0 is available on the expansion port.
The TX line is available inverted as the logical OR of bits D0, D1, and D4 of $4017. If zero, TX is high (Mark state). The other bits in $4017 may be assumed unchanging while receiving a byte.
The RX & /CTS pair is controlled by either $4016 D0. /CTS might not be supported by a given cable, in which case flow control can't be done. Software should write zero bits for D2-D4, in case they are used for other things. Also, at some point OUT1 may be used for serial output, so software should try to output serial data on OUT0 and OUT1.
D0 (data), D1, and D4 are inputs for second controller ($4017). OUT0 (strobe) is from the CPU ($4016). For clarity, unused pins are not numbered or labeled.
_ GND |1\ |.5| +5V OUT0 |3.| D0 |47| D4 '--'
Male connector. Not yet verified
GND D4 ----------------------------------- \ 1 . . 4 . . . . / \ / \ . . . 12 . . 15 / `---------------------------' OUT0 +5V
------- | ___ | +5V | 1 48 | +5V GND | 2 47 | GND | [ ] | | [ ] | | [ ] | | [ 43 | OUT0 | [ ] | | [ ] | | [ ] | | [ ] | | [ ] | (back) | [ ] | (front of NES) | [ ] | | [ ] | | [ ] | | [ ] | | [ ] | | [ ] | | [ ] | D1 | 20 ] | | [ ] | | [ ] | | [ ] | | [ ] | | --- | -------
TX connected to three bits: The NES controller port exposes D0, D3, and D4. The expansion ports of NES and Famicom exposes D0-D4. The Famicom controller is hardwired to D0, so D0 alone can't be used on both. D3 and D4 are available on both, but many NES controller cables don't connect either one, and use of them would interfere with a NES controller that uses them. D1 is available on both, but it requires connecting to the NES expansion port, for which the connector is rare/non-existent. So we use D0, D1, and D4.
D0 allows use of the common NES controller cable. D1 allows use of a second NES controller at the same time. D4 allows modification of a NES extension cable to pass through D0 to a controller, and connect serial at the same time. D3 could have been used, but D4 has some possible benefits in software reading using CMP $4017 to read the bit. Also, the Zapper, which connects to D3 and D4, has the trigger connected to D4, so it won't generate any false data unless pressed.
Once more than one must be supported, it's easy enough in software to support all three. This involves either LDA $4017 : AND #$13 : CMP #1 to put it into the carry, or LDA $4017 : AND #$EC : TAX ... CPX $4017 to put the inverted version into carry.
Active-high TX and RX: A serial cable should be as easy to construct as possible. The FTDI TTL-232R USB-to-RS-232 cable outputs TTL levels, allowing construction of a serial cable with no soldering, just splicing it to a NES controller cable. Thus, we should use the same levels as this uses. It happens that these match those of a MAX232 level converter as well. It also happens that these match that of using simple transistor inverting buffers to convert levels. Since RX and /CTS are connected together, and CTS is normally non-inverted, we get the inverted /CTS.
Contact Shay Green