Emulating the Amstrad CPC on NetBSD

August 13, 2022

Introduction

The Amstrad CPC was a series of 8-bit computers running on a Z80 processor that gained a foothold in Europe in the mid-1980s – especially in the UK, France and Spain. The CPC 464 and 6128 were by far the most popular models.

During its heyday, the Amstrad CPC was unheard of in the US, where I live. And I have never seen one in real life before (except maybe at the Computer History Museum, I can’t remember though). The closest equivalent in the US is probably the Commodore 64, which I never had in my childhood (I grew up in the 1990s) but at least I was aware of those.

Previously, I had not known much more beyond the fact they existed. But when I became a fan of Noel’s Retro Lab on YouTube, I got to learn all about them (The CPC 6128 is Noel’s favorite retro computer, and he grew up with one as a kid). And now I believe they are super interesting machines and I want to learn even more about them!

When I discovered most of the popular CPC emulators only worked on Mac, Windows and/or Linux, I knew I had to get at least one working on NetBSD. I suppose MAME would work, but I don’t like MAME. Instead, I was able to bring Tom Harte’s multi-system emulator called Clock Signal to pkgsrc-wip and run some games. It has a very minimal user interface, which can be confusing at times, but I’ll show you how to get it working.

Installing and Configuring Clock Signal

Currently, Clock Signal is only in pkgsrc-wip, so you’ll need to build it from source. You need a recent checkout of pkgsrc-wip.

Build and install the clock-signal package:

$ cd /usr/pkgsrc/wip/clock-signal
$ make && make install clean clean-depends

This provides a program called clksignal.

In order to emulate the Amstrad, you’ll need the appropriate ROM image(s). See here to learn which files the emulator expects. The pkgsrc package does not provides the ROM images, but – curiously – the precompiled package for macOS does. Go ahead to the releases page on GitHub and download the most recent zip archive for macOS. It will extract into a ‘.app’ directory, which is indeed the executable for the Mac, but look inside and you’ll find the ROM images:

$ ls Clock\ Signal.app/Contents/Resources/ROMImages

You should save the ROMImages directory somewhere, for example, ~. We got what we need, we don’t need the Mac app anymore.

The clksignal is very finicky and particular when parsing command-line arguments. You MUST use the equal signs and all that, it’s very annoying.

Here’s how to emulate the CPC 464:

$ clksignal --rompath=${HOME}/ROMImages --new=AmstradCPC --model=CPC464

And the CPC 6128:

$ clksignal --rompath=${HOME}/ROMImages --new=AmstradCPC --model=CPC6128

In both of these cases, you should be dropped into the Locomotive BASIC prompt.

Insert a disk or cassette tape image

The user interface of Clock Signal is very minimal. The only easy way I know of to insert a disk image (or cassette recording) is to actually pass it in on the command line, for example:

$ clksignal --rompath=${HOME}/ROMImages --new=AmstradCPC --model=CPC6128 ~/games/magica.dsk

You can confirm the disk was loaded with the Amstrad’s cat command (for disk CATalog).

Take a screenshot

Press Ctrl-Shift-D to take a screenshot. It’ll be saved as a BMP image in your home directory. I’ve noticed that the size of the BMP corresponds to the size of the emulator’s window – meaning the screenshot’s pixel dimensions aren’t necessarily the same as an actual Amstrad.

Caveats

The slightly nonstandard layout of the CPC’s keyboard will most likely conflict with your NetBSD machine’s keyboard. It’s a matter of whether the emulator should respect the key-symbols you’re typing, or the numerical keycodes. For example: on my US-English QWERTY keyboard, Shift-2 prints “@” normally, but that is where the double-quote character was located on the CPC’s keyboard. It can be tricky to keep it straight. You are able to change this behavior with the non-SDL versions of Clock Signal (the Mac verison especially), but I’m not sure how to change this behavior with the SDL version, which is what the pkgsrc package provides :(

That’s it!

Let me know if it works for you! I’ve had success on NetBSD/amd64 9.3.