When I was young, I learned computing using a variety of 8-bit microcomputers. Many of these used the Z80 CPU. For a long time, I’ve had it in the back of my mind to build my own Z80 microcomputer from scratch, and I’ve now started on this project.
To get going, I ordered the Z80 and various support chips (SRAM, Flash ROM) from mouser.com. Yes, you can still buy brand-new Z80 chips even today, nearly 40 years since its introduction! I decided to prototype the project using a breadboard, so I purchased a large one of those to. The first pass is shown below:
The chips there are: Bottom/right: Z80 CPU. Bottom left: SST Flash ROM. Middle left: Static RAM (yes, I cheated and didn’t use Dynamic RAM). Top left: Teensy 2.0++. Grey wires: connections to my HP 16550B logic analyzer for debugging (I forgot to tell the Teensy to stop driving the bus RD_/WR_ lines, which prevented the Z80 from being able to access the bus).
To simplify debugging, I also chose to add a Teensy 2.0++ onto the address/data/control bus in addition to the Z80. The Teensy is able to interact with the same peripheral chips that the Z80 does. This way, I can prove out most of the computer without relying on the Z80. Once the wiring is working, I can get the Z80 itself going as a separate step. The Teensy also controls the clock and reset of the Z80, so can act as a debugger, and even temporarily pause Z80 execution so it can read/write RAM while the Z80 is running. I used that feature to implement an in-RAM “virtual UART” for communication with my laptop via the Teensy’s USB port, so that I didn’t need to wire up a real serial port chip in the first pass. It seems a little odd that the CPU I’m using as a debugger is faster and more powerful than the entire system I’m building, but in retrospect, isn’t debug hardware usually high-end and expensive?
Once everything was working, I looked around for some real software to run. I found that Grant Searle had extracted the BASIC implementation from the ROM of a NASCOM computer, and publishes it in source form. I downloaded this, adjusted the RAM address to match my system, implemented the serial port read/write functions, and loaded it into my system’s flash ROM. It works! See the screenshot below:
A rough TODO list for the project is:
- Supply the Z80 clock from the crystal I purchased, rather than via SW bit-banging it from the Teensy. I also hope to add a Teensy-controlled clock-gate for debug purposes, so that for debug operation (like single-stepping) the Teensy can take over clock control.
- Implement a physical serial port using the Z80 CTC and SIO chips.
- Lay out a custom PCB for the project, so I don’t have to fit hundreds more wires into the breadboard. I’m currently learning KiCAD to enable this.
- Add more peripherals: Floppy disk, hard disk, parallel printer, front-panel bus control, blinkenlights, VGA/HDMI output, etc.
- Port CP/M.
- Add configurable address decoding so that more than 64K RAM/ROM can be supported. This will be required for a CPM 3.x port (although not for a CPM 2.x port).