- /IRQ circuitry removed
- changed circuit to handle positive idle clock lines
- added pull-up resistors to peripheral $4017 data lines
I've been playing with the idea of having multiple peripherals connected to the famicom expansion port and came up with this potential solution. The circuit has only been simulated and hasn't been tested on real hardware. My hope is that people will provide feedback on design considerations and flaws before I move toward hardware testing. Attached are the files I created using Logisim if you care to simulate my circuit. Logisim is a free digital simulation software I discovered just a few days ago and has a very easy learning curve. You can find it here: http://www.cburch.com/logisim/
This circuit functions like a multiplexer for all the digital I/O signals on the expansion port, allowing you to have up to 8 addressable expansion ports. Only one port can be active at a time. Once a port is active, the circuit becomes passive and communication between the console and peripheral can proceed as normal.
When the circuit is in program mode and/or when a port is not active, $4016.OUT2-0 at the peripherals become high impedance. Therefore, pull-up/down resistors are needed to hold peripherals in a standby condition when not in use. This was intentionally designed for peripherals like the gameboy printer that require a specific idle state. On the console side, $4016.D1 and $4017.D4-1 become high impedance and the /IRQ line is held high during program mode.
The desired port is made active by the following sequence:
- Write $07 to $4016 then read $4016 to pulse the clock line. This puts the circuit in program mode.
- Write the desired port # ($00-$07) to $4016 then read $4016. This writes the contents of $4016.2-0 to the circuit's address latches, enabling the desired port. Although the port is now enabled, it cannot yet communicate with the console.
- Write the desired initial condition of the new port to $4016 then read $4016. This makes the new port active and communication with the console is now possible.
The following code would enable the Family Basic Keyboard on port 2. In theory, if we configure the resistors on the port 2 OUT2-0 lines to hold the keyboard in its reset state ($05) while the port is idle, you could immediately begin reading the keyboard once the port is active.
Code: Select all
;-----put circuit in program mode----- lda shadow_4016 ora #$07 sta shadow_4016 sta $4016 ;write $07 to $4016 lda $4016 ;and pulse the $4016 clock line ;-----enable the new port----- lda shadow_4016 and #$02 sta shadow_4016 sta $4016 ;write the desired port # to $4016 lda $4016 ;and pulse the $4016 clock line ;-----activate port and begin reading the keyboard----- lda shadow_4016 and #$f8 ora #$04 sta shadow_4016 ;write the initial condition to $4016 sta $4016 ;and pulse the $4016 clock line ;-----communication between console and peripheral can proceed as normal from here-----
Here are some design considerations I've had thus far (in no particular order):
- This circuit will require a separate power supply (not shown in schematic) and provide the power to all peripherals.
- an analog multiplexer could be used for the sound input if desired.
- The 74hc244 chips used for the $4017 data lines could be replaced with 74hc151 and addressed using the q2-q0 lines from the 74hc173. The potential advantages of this would be that $407 D4-1 would be logic 0 instead of high impedance when the circuit is in program mode, and I imagine it would require less pcb traces to route all the necessary signals.
- The combination 74hc151 + 74hc173 essentially create a 74hc356, so a '356 could be used if you have one on hand. I couldn't find them on the mouser website so I chose the '151 + '173 combination.
- The theory behind the two OR gates that buffer the clock signal input of the 74hc74 is to utilize their propigation delay and keep the '74 Q1 high long enough so that the clock signal through the AND gate will properly load the OUT2-0 data to the address latches before Q1 goes low.
- Because loading $07 on the OUT2-0 lines is required to enter program mode, the active peripheral will see this value before the circuit is put in program mode. This was intentional so that $07 could be used as a peripheral command if desired. If a peripheral would somehow be damaged by receiving $07 on the OUT2-0 lines, additional circuitry will be necessary to protect it.
This is the updated v2 schematic