Oli's old stuff

Tinkering with retro and electronics

Jan 1, 2022 - 7 minute read - amstrad cpc z80 retro breadboard electronics hardware rc2014 bbz80

Breadboard Z80 Computer - Part 2

This is the second post in a series about building an RC2014 compatible Z80-based machine from scratch. It’s based loosely around the Amstrad CPC 464.

In the last post I talked about the breadboard computer I started building in early 2021. I’m loosely calling it “bbz80”, but perhaps I need a snappier name.

It’s time to move away from breadboards to end up with something without as many wires!

System Overview

We’re building an 8-bit computer based on the Z80 CPU. The computer will be a modular system based on the RC2014 bus, ideally allowing interoperability with other RC2014 modules.

The broad overview of board modules we’ll need:

  • Z80 CPU board
  • System Clock @ 4MHz
  • 64K RAM / 32K ROM (2x16K banks) & paging logic
  • Serial board (for debugging)
  • Keyboard - TBD
  • VDU - TBD
  • Audio - TBD
  • Maybe a debugging board (blinkenlights, etc)

The memory and paging architecture is based loosely around the Amstrad CPC 464. Whether other CPC features are adopted remains to be decided!

This gives us a memory map of:

Address Page RAM ROM
$0000-3FFF 0 RAM0 ROM0
$4000-7FFF 1 RAM0 X
$8000-BFFF 2 RAM1 X
$C000-FFFF 4 RAM1 ROM1

The system always writes-through to RAM whether the ROM is paged or not, a RMR register controls the paging.

I talked about this a little last time, and will cover again when we start building the board.

RC2014 Bus

The RC2014 is a fantastic project. Spencer has made all his schematics and BOM lists public - it allows folks like me to get started pretty quickly and provides some support if I get stuck figuring things out myself.

Let’s take a look at the RC2014 bus we’ll be basing everything around.

The bus itself is a 40-line bus designed around a single row of 0.1" SIL pin headers. The standard RC2014 machines are built around a backplane which carries the 40 bus lines to several stand off female pin headers. Modules are connected to these headers via right-angled male header pins, meaning the cards stand at 90 degrees to the backplane.

The RC2014 bus is essentially a subset of the Z80 address, data and control signals - but it’s ordered in a nice linear format.

Lines 1-16 carry A15->A0, then we have GND and +5V on lines 17 and 18. CPU control signals are between 19 and 26, before the databus D0->D7 on 27 to 34. It is sort of odd that the Address bus lines are in descending order and the data bus lines are in ascending order, but it doesn’t make much of a difference.

Lines 35 and 36 carry the TX/RX signals from a serial IO system, but aren’t essential. There’s 4 user signals on the last lines which are used for whatever you need.

The standard 40 line v1.0 bus is missing some signals from the Z80; notably inputs /WAIT, /BUSREQ and /NMI, and outputs /HALT, /BUSACK. These are addressed in the v2.0 “enhanced” bus, as well as more data, clock and serial lines.

Construction

I will be building this from a combination of stripboard and home-etched single-sided PCBs. Breadboards will be used for prototyping module designs before committing to stripboard or a PCB.

Maybe in the future I’ll get some proper PCBs made up, but past experience with the 3 week wait for delivery from China can really crush iteration times on a project, especially if there’s faults.

It’s worth noting that for some of these things I could buy a real RC2014 board/backplane and use that. I’ve decided not to do that yet as I want to build everything myself. However in the future I almost certainly will be picking up an RC2014 kit with the aim to attempt to interface some of these modules to it. Plus, it’s a nice looking kit and I fancy having a go at building one.

Now that’s all figured out, time to start working on this.

Z80 Module

Let’s start with an easy one, the CPU module. This module does little more except break out the Z80 CPU pins to the bus and provide some pull up resistors to the input signals /INT, /NMI, /WAIT, /RST and /BUSREQ. Without pullups, these input pins will float and interfere with the normal operation of the CPU.

Because of the choice to use stripboard, it’s very likely that supporting the v2.0 bus directly on the backplane isn’t going to be viable. Instead, I’ll break out a subset of the v2.0 onto headers on the top.

There’s a few ways this stripboard layout could be done. The first approach I adopted the “traditional” way - using very few jump “wires” and tried to follow the Manhattan Routing method as strictly as possible. The main issue here is that it seemed to lead to longer tracks overall, with some requiring several track jumps to get from A-B.

In the end I settled on a “screw it, jump wires aren’t so bad” approach and will be using other over- and under-board wiring. It’ll lead to an uglier board, but should let to build it faster.

The details of the CPU module can be found on the bbz80 github page. It’s a bit janky, but should do.

Backplane

With the CPU module designed, it’s time to look at the backplane. Ultimately, this will be a big run of stripboard with several slots worth of header rows.

A few decisions to be made here:

  • how many header slots do we need?
  • will we ever need to isolate slots?
  • is power going to be built into the backplane?
  • how are we going to power this at all?

As a crude estimate, I’m going to need a slot for the CPU, Serial IO, RAM/ROM, VDU, Audio, Debug and maybe other things I don’t know about yet. Planning for 9 slots at least gives room for future expansion. The RC2018 kit comes with 5 or 8 slot backplanes, but the “pro” version goes all the way up to 12.

Next comes the choice in how wide the slot spacing should be. Using stripboard as a measure, a gap of 5 holes between slots is approx 10mm. 1cm isn’t a lot of clearance for a socketed IC, especially if the back has wiring. So at least 16mm (~8 holes) taking us up to 20mm (10 holes) with the headers would be ideal.

9 slots with 20mm spacing needs a backplane of at least 180mm. I’ve got several 114mm x 365mm veroboards so I can dedicate one to the backplane with lots left over.

When it comes to isolation, I’m simply not sure if I need that feature yet. I’m not creating an RC2014 myself exactly, but something that should be compatible with it. Realistically, the modules I’m building for the bbz80 will be designed to be used together and shouldn’t need cordoning off from each other. As it stand, I’ll rule out the need to isolate slot groups.

Power

Power is an interesting one. At its heart the entire machine will need a 5V DC connection. But what options should we take for delivering this?

  • Barrel jack input
  • Terminal block input
  • USB power?

I’ll be doing a lot of work with my bench supply, so taking in 5v directly via terminal blocks is ideal here.

Afterwards, I’ll probably want to run this whole rig from a barrel jack input. For safety, this should be regulated with a 7805 voltage regulator to allow me to use a 9V or even 12V input supply. Powering from USB is interesting, but I don’t have any breakout boards that would let me do this. One option I have is a breakout board based on a FT232RL; this provides both serial IO and power, but I’m semi-reluctant to use this to power the whole machine - mostly as I’m not sure how many amps it’ll end up pulling. Using this directly on the backplane immediately bleeds from the potential serial IO module onto the bus too.

For now, we’ll leave USB-power off the table.

On top of provision for a barrel jack and terminal block, I think breaking out two headers for +5V and GND makes a lot of sense too. It starts giving me options for external power beyond the terminal block.

The stripboard design for the backplane with power can be found in the github repo.

Wrapping up

The CPU module and backplane have been designed. I’ve not built them yet as I’m still waiting for bits like sockets and header pins, but I can start cutting boards and preparing.

The next post will look at the clock module and maybe the RAM/ROM module too.

ret