Main Content

A Z80 CP/M emulator for the SAMD51

Retro computing is very popular. It’s interesting to experience what computing was like in the 80s when 8-bit processors were the standard and 64K of memory was generous.

While you can get a taste of this by using an ATMega328 based board such at the venerable Arduino UNO or a Metro 328, but it’s not quite the same as using a 6502 or a Z80.

You can go all the way to the hardware level and get something like the RC2014 Z80 computer kit for the full experience, or you can stick with an emulator on your desktop machine.

This guide takes you somewhere in-between. It looks at running a Z80 emulator on state of the art microcontroller hardware. Specifically, a Grand Central M4 Express. This board is built around the SAMD51 MCU which has plenty of memory and power to run an emulator in real time. Just as importantly, it has an onboard SD card slot which is needed to house CP/M’s virtual disks.

While this guide is written for the Grand Central M4, any SAMD51 board has plenty of power and memory to handle the job. You’ll have to add an SD card shield/wing and make corresponding changes to the code for the board definition and SD interface.
We’ll start with a brief discussion of the Z80 CPU, what it was and why it was so important in the history of personal computing. Then we’ll talk briefly about CP/M, one of the more popular operating systems for the Z80.

The emulator we’ll use is RunCPM. It can be found on github. There are a few changes required to make it work on the GrandCentral, mostly just to tell it about the board. We’ll take care of those and get it running.

With it running, we’ll take a brief look at operating CP/M running on the Z80 that is emulated by the Grand Central.

Finally, we’ll come full circle in a way and explore how to use the Grand Central’s I/O pins from Z80 assembly language.”

Link to article