TYNEMOUTH SOFTWARE ZX SPECTRUM IO BOARD
PARTS LIST
CAPACITORS – CERAMIC RATED 6.3V OR HIGHER
5 x 100nF axial (usually marked 100n or 104)
SEMICONDUCTORS – HCT RECOMMENDED, LS COULD BE USED, HC NOT RECOMME NDED
1 x 74HCT138
2 x 74HCT245
2 x 74HCT574
CONNECTORS
4 x 10 way 0.1” header or other 0.1" connector (molex / jst / dupont etc.)
56 way 0.1" edge connector (68 way are easier to locate, cut down to size)
COMPONENT PLACEMENT
ASSEMBLY
Start with the capacitors, then the ICs, or you can fit IC sockets if you like. You can omit the 74HCT245 chips if
you are not using the input ports, or the 74HCT574 chips if you are not using the output ports.
If necessary, cut the edge connector down to size, and bend the pins reach the pads on the board. Two pins
should be removed where there is a gap. Fit a piece of card or plastic cut to size into the connector so it will
align with the ZX Spectrum
Finally, fit connectors as required for the inputs and outputs. The top pins with the square pads are ground,
the opposite ends are 5V, and the 8 pins in between are D0-D7, with D0 nearest the square pad.
www.tynemouthsoftware.co.uk
ADDRESS DECODING
EDGE CONNECTOR AND ADDRESS DECODING SCHEMATIC
ADDRESS DECODING
The 74HCT138 3 to 8 line decoder is used to generate the control signals for the input and output chips. The
address bus is partly decoded. To enable any of the IO chips, A0 needs to be high, A2 needs to be low, and
/IORQ needs to be low. This will be an IO request to address ending in 1 or 3. These include 0x01 and 0x03
through to 0xF1 and 0xF3. It also decodes as 0x09 and 0x0B through to 0xF9 and 0xFB. All even ports are
avoided as these are used by the internal port on the ULA which only checks that A0 is low.
The 138 will generate eight active low enable lines, based on the three inputs, A1, /WR and /RD. The eight
decoded outputs are as follows:
A1 WR RD Signal
0 0 0 Should never happen (unused)
1 0 0 Should never happen (unused)
0 1 0 Read from address x1
1 1 0 Read from address x3
0 0 1 Write to address x1
1 0 1 Write to address x3
0 1 1 Neither read nor write (unused)
1 1 1 Neither read nor write (unused)
www.tynemouthsoftware.co.uk
INPUTS
INPUT SCHEMATIC
DESCRIPTION
To provide digital inputs, two 74HCT245 buffer chips are used. When the output enable line (/OE) is low, the A
signals are connected to the B pins. This transfers the signals from the input connectors to the databus. The
direction is fixed; these lines are for input only.
The 74HCT245 inputs are TTL level compatible, inputs should be approximately 0-1V for low and 3-5V for high.
No pullups are provided; pullup or pulldown resistors should be fitted when using switches as inputs.
OUTPUTS
OUTPUT SCHEMATIC
DESCRIPTION
To provide digital outputs, two 74HCT574 latch chips are used. When the clock line (CLK) transitions from low
to high, the current values of the D inputs is latched and when the output enable (/OE) is low (which it always
is), this is output on the Q pins. The Q outputs remain in this state until the latch is triggered again.
The 74HCT574 outputs are totem pole style CMOS outputs, which can source or sink 6mA. This is sufficient to
drive LEDs etc, but buffering circuitry should be used for loads such as relays or motors.
www.tynemouthsoftware.co.uk
PROGRAMMING
BASIC
Both the input and output ports can be accessed from BASIC, using the IN and OUT commands.
INPUT
The input ports are at 0x01 and 0x03, and can be accessed from BASIC using the IN command.
IN 1
So for example,
PRINT IN 1
will print the value read from input port 1
IF IN 3 = 8 THEN GO TO 100
Will test to see if digital input port 2 has all input low bar pin 4
OUTPUT
The output ports are also at 0x01 and 0x03, and are controlled using the OUT command.
OUT 1, 255
This will turn all of the pins of output port 1 on (5v).
OUT 3, 0
This will turn all the pins of output port 2 off (0v).
The output is latched, and will retain this setting until it is changed.
ASSEMBLY LANGUAGE
It is beyond the scope of this document to describe this in detail, but the standard Z80 instructions for input
and output are used.
in a,($01)
out ($03),a
NOTES
The Spectrum +2 and +3 use all the even addresses, and also every forth address starting at 1, so will conflict
with the address decoding. If you wish to use this board with a +2 or +3, cut the trace that goes from pin 1 of
the 74HCT138 to pin 10 of the edge connector on the underside of the board and wire it instead to pin 12 of
the edge connector (which is A3). The port addresses then becomes 0x03 and 0x0B.
www.tynemouthsoftware.co.uk