Building a Z80-based Computer

Overview

I started programming on a ZX Spectrum computer, which was a widely popular and successful microcomputer in the UK in the 80s.

Like many other teenagers at that time I started writing code in BASIC, then later moved on to assembly language coding. Recently I've been feeling nostalgic, and due to my growing interest in experimenting with hardware I decided to "build a computer".

With my previous history of using Z80 assembly language building something around the Z80 was a natural choice. You can buy the processor as a standalone chip for about €0.80, and they're pretty simple to wire up and get running with no real need for supporting hardware.

Naked Chip

There are a lot of youtube videos showing how to wire up a Z80 processor upon a breadboard, for example:

These projects demonstrate the basics:

  • Connecting a Z80 to power.
  • Generating a clock signal to make it tick.

However they do suffer from the problem that there is no actual code running; there is no RAM/ROM and the I/O is limited to showing some LED activity when addresses/lines are accessed.

(The Z80 will request the contents of RAM, when it is powered on, fetching the instruction at address 0x0000. Since nothing is attached the read will essentially result in 0x00 being returned, which corresponds to the instruction NOP. The end result is that a standalone processor will endlessly fetch instructions over and over again, and run freely executing the NOPs it thinks it received in response.)

A more useful interface

It occurred to me pretty quickly that I could connect the Z80 to an arduino, which could then generate the clock-pulse to drive the chip, and also react to RAM and I/O requests.

To kick-start the process of development I setup a Z80 emulator, and started writing some simple Z80 assembly programs. The intention was to start getting comfortable, before proceeding to the use of real-hardware.

Eventually my goal will be to put together a circuit with RAM, ROM, clock, and a Z80 processor to function in a standalone fashion. But to get started I ordered a Z80 retroshield which is a simple add-on board whihc allows an Arduino Mega to interface with a Z80 in a clean and simple fashion.

Once I had the shield my first step was to get it executing some simple code, and that resulted in the creation of a simple library to drive the Z80 along with some test-programs:

Further Work

I started work on a simple Z80-monitor, but I've not yet got it working in a useful fashion. Once it is I'll be able to look at using EEPROM and wiring up external RAM, etc.