Retro Z80: CPU Board


I have been busy with designing a PCB for the Z80 CPU. This CPU Board has 4x 64k (x8 bits)  static RAM on board next to the Z80. It also has an additional 32k of RAM that serves as a Memory Management Unit (MMU) for deciding which 4k blocks of the 4 banks of 64k are in the active 64k range and where.

Here is the board as it arrived today. I had it made in China with Elecrow (found through pcb-shopper) and they did an excellent job for a small price tag.


There are two 40 pin headers on each side of the board that runs bus signals to the other boards that are yet to be designed. The idea is that a stack of these 10cm x 10cm boards all connected to the common bus, makes a complete computer system.

Next up is the decoder board that decodes all the control signals from the common bus feeds them back to the CPU-board – thats the connector on the top-right side. The decoder board contains an Altera Max II (240) with a load of passives (clamp diodes, pull-up and series resistors) to adapt the 3.3V CPLD to the 5V bus. I am designing that now. I have waited until I got my CPU board back. If there is any (stupid) mistakes in the CPU-board, I can correct them (or learn from them) in the decoder board. All these boards will have the 4 mounting holes in each corner and the two bus connectors (as well as the power supply connector in the top right).

The only downside…. I have 12 of them (I ordered 10)…


I have also been busy with the software. I have created a custom target for the z88dk. It was quite a tedious process because my test setup had a couple of hardware bugs (wiring faults). These errors caused the system to run ok on small programs but hang on larger programs. So always check your wiring twice!

Once I had the hardware sorted, the software started to work pretty quickly. A z88dk target consists of startup code to connect the C program with its execution environment (the computer). This can optionally contain a bios at address $0000 which I used to test with. I only coded the entry points for the RST instructions and NMI interrupt so I could catch those if they happened. The z88dk uses drivers to connect the C-porgram to things like the stdin and stdout streams (although in C this structure is called FILE – talk about a bad name). If you recall I had the basic input and output working on the System Contoller so I implementing these drivers for basic IO was dead-easy.

The complexity (at first) in creating a z88dk target lies in the structure, organization and mechanisms used in the z88dk. Thankfully they have a forum and you receive very elaborate answers on your questions – excellent support.

I added two commands for the System Controller. A Memory Fill (mf) that allows you to initialize a part of the RAM memory. This has been useful to ensure you start with a clean slate for each test run. I also added a Terminal Off command (to) that makes the System Controller ignore the incoming serial data. It just keeps it in its buffer and now the Z80 can use the input instruction to retrieve the characters.

Next Steps

Next I will finish designing the decoder board and get started with advancing the bios for the system as well as the C integration. There are a couple of more drivers I need to look at in detail.

I will also start to think on how I wish to manage those 4 banks of 64k of RAM memory. The z88dk C compiler supports a 24 bit far memory model but I cannot see (yet) how to map that to my MMU mechanism of 4k blocks that can be swapped and positioned anywhere…

Published in: on April 17, 2016 at 1:13 pm  Leave a Comment  

The URI to TrackBack this entry is:

RSS feed for comments on this post.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: