Making a stand-alone Z80 CP/M computer

I didn’t expect it, but there has been a lot of interest in my video series on building a standalone CP/M computer. What I’m doing is to use a Z80 Playground as the motherboard, a VGA32 as the terminal board, and put the whole lot into a case. I am then adding a keyboard and a monitor, to get a finished computer, 1980-style! Here are the videos in the series:

Part 1
Part 2

Calling CORE functions on the Z80 Playground

When you start CP/M the following 4 .bin files are loaded into memory:
Core – A bunch of core routines, for leds, disks etc
BIOS – A stub of a BIOS
BDOS – The main part of CP/M
CCP – The interface of CP/M.

The location that the files are loaded into is dictated by the cpm.cfg file. You see these values when CP/M starts:


The CORE.BIN file contains various functions for accessing the hardware, such as switching on LEDs etc.

The Disk, User and Rom LEDs are connected to the 16550 Modem Control Register port. The ports are shown in one of the Monitor screens:

16C550C UART Ports     CH376S Module Ports
-------------------    -------------------
TX / RX           8    Data Port        16
Interrupt Enable  9    Command Port     17
Interrup Status  10
Line Control     11
Modem Control    12
Line Status      13
Modem Status     14
Scratch          15

So, to turn on the Disk LED (for example) there is a piece of code already loaded up in the CORE that looks like this:
; turn disk LED on
in a, (uart_MCR)
or %00000100
out (uart_MCR), a

If you want to call any of the core functions from a .com file you can include the core_jump.asm file in your program. This is just a list of all the core routines, arranged as a jump-indirection table, just to make life easier. You’ll need to include port_numbers.asm and locations.asm too, which are just some EQUs. You can then toggle the disk light by calling CORE_disk_toggle.

2048 – A genuinely addictive game for CP/M

The only games that I have played on CP/M that have been any good up until now have been text-based adventures. The other games, like Pacman, have all been a bit underwhelming. But now I have found 2048 and it is actually really good. It’s a sliding tile puzzle game where you have to combine numbers to get to 2048 (which I have not yet achieved). Once you get the hang of it, it is strangely addictive.

The controls are:
A = Left
D = Right
W = Up
S = Down

I think it could be improved with some animation, and maybe better use of colour. But it’s very good. Here it is:

Z80 Playground v1.2 Schematic

Here is the schematic for the latest version of the Z80 Playground. This is the version that I am selling on eBay.

I’ve improved the logic around the peripheral ports so it is simpler. I’ve added an /int button, and there are a few other minor improvements. I’m very happy with this version. It’s the best yet!