Z-80 Homebrew: I/O board!

The next step on my Z-80 journey is building the I/O. I decided to do this before building the processor circuit itself as it doubles up as a handy test device.

Z-80 I/O
Z-80 I/O

There are three output ports that use TIL311 displays; I got these cheap off eBay from Hong Kong. They take a four-bit input and display it as a hexadecimal value. Therefore, in pairs, they can display binary data from the data bus as a hexadecimal number 00h – FFh. They aren’t all connected to the data bus; I’ve kept them separate, so if necessary I can connect them to the address and data bus and for troubleshooting my ROM programmer.

The keypad follows Ciarcia’s design, but modified to use available components. Basically, there is a 556 timer (lower right chip) that has an astable oscillator providing a clock signal of approx. 3kHz. It goes through a NAND gate (upper left) before driving a binary counter (middle right). The counter outputs a four-bit number to a 4 to 14 demultiplexer (lower left). The 16 outputs are connected to the 16 numerical inputs, which are labelled using handwritten stickers to add to the homebrew feel. When one of these is pressed a monostable timer sends a 10ms signal (longer if the switch is held). First, this debounces the switch; second it stops, via the NAND gate, the clock signal. The four-bit number outputting from the counter is then held at the number pressed, which corresponds to the value of the button, and the four bit number is present at the bus buffer (top right) to be read by the CPU. When the CPU is looking for a value from the keypad it will read this buffer and get the number from the lower four bits. The next three bits are the modifier keys and finally bit 7 is the output from the monostable timer that tells the CPU that a key has been pressed and a value can be read. A software flag will ensure that the value is only read once.

ROM is necessary to boot the computer. Gone, however, are the days of needing EEPROM or UV erasable chips and their expensive programmers. Instead a few pounds will by a 4Mbit CMOS flash chip. So to program this chip, which can be done quickly using a single 5V supply, a simple Arduino sketch is required that uses shift registers to provide a parallel output. This is currently underway and it is possible to debug it using the I/O board.

Shift Register Test
Shift Register Test Using Z-80 I/O

Here, three shift registers are connected to the Arduino providing 8 bytes of output. The top two will drive the address bus and the lower provide the data. For now, though, it is just a proof of concept and is running a simple counter. Eventually, it will be possible to program it using data sent over the serial port of the computer.

Z-80 Homebrew – First Update

I’ve always wanted to build my own computer from the circuit up; so inspired by Steve Ciarcia’s Build Your Own Z-80 Computer and my success building a computer from CMOS Logic I thought it was time to have a go! Most of the components are no longer available, but the Z-80 CPU itself is still in production. So with a bit of re-designing it should be easy to build a computer following Ciarcia’s design.

First up: the power supply. It’s a simple design based around a 7805 regulator that takes a 9V supply from an old transformer and reduces it to a regulated 5V supply, with a maximum current of 1A.

Second: the clock. The Z-80 is available today at speeds of up to 33Mhz, but I bought a 4Mhz version. I’m not trying to replicate a vintage computer, it’s just an educational project, but it should be fast enough for any machine code I’ll write for it and slow enough to avoid any timing issues.

Prototype Power Supply and Clock
Prototype Power Supply and Clock

I’ve left them on breadboard for the time being; I don’t know how I will lay out the completed project yet.

Using an oscilloscope it’s possible to see the clock signal.

Clock Signal
4 Mhz Clock Signal

Connecting the power supply to the second oscilloscope channel shows how it is affected by the clock. The scale is very high (.1v per division) but demonstrates the need for decoupling capacitors very well. I’m using a 0.01 and 0.001 uF.

Clock with Power Supply
The Clock Signal and Power Supply

Next: The I/O!