Amstrad CPC Emulation on Fedora Linux 27 using MAME

It is now January 1st, 2018. I decided that I would start the new year by doing something I have never done before: by trying out Amstrad CPC 8-bit microcomputer emulation on Linux. In fact Amstrad CPC computers are completely new to me, I have never used real, physical Amstrad hardware before. I have only seen those computers in photos. As far as I can remember, the Amstrad CPC computers were pretty expensive back in the 1980s when they appeared. I am not totally sure, but they may have been even more expensive than Commodore 64. In Finland where I live, Amstrad CPC computers were never that popular. This is not to say they were bad machines. On the contrary, I have read good things about them.

I started by googling for "amstrad cpc emulation for linux". Using that search, I found this freehackers.org page. It says:

There are a bunch of amstrad emulators for linux. Most of them are not maintained, obsolate (sic), and more or less working with recent distributions (gcc4, X, SDL,...). I try to keep information about the state of those emulators on this page.

It was good to know Amstrad emulators do exist, but bad news that they were not maintained or were obsolete. MAME was mentioned, and I already had it installed. I issued the shell command command:

rpm -qi mame

It queries the Fedora Linux 27 RPM database which contains information about installed software packages. I got the response:

Name : mame
Version : 0.192
Release : 1.fc27
Architecture: x86_64
Install Date: Tue 19 Dec 2017 04:36:54 PM EET
Group : Unspecified
Size : 212000425
License : GPLv2+ and LGPLv2+ and ASL 2.0
Signature : RSA/SHA256, Sat 02 Dec 2017 11:27:24 AM EET, Key ID f55e7430f5282ee4
Source RPM : mame-0.192-1.fc27.src.rpm
Build Date : Fri 01 Dec 2017 07:31:38 PM EET
Build Host : buildvm-18.phx2.fedoraproject.org
Relocations : (not relocatable)
Packager : Fedora Project
Vendor : Fedora Project
URL : http://mamedev.org/
Summary : Multiple Arcade Machine Emulator
Description :
MAME stands for Multiple Arcade Machine Emulator. When used in conjunction
with an arcade game's data files (ROMs), MAME will more or less faithfully
reproduce that game on a PC.

The ROM images that MAME utilizes are "dumped" from arcade games' original
circuit-board ROM chips. MAME becomes the "hardware" for the games, taking
the place of their original CPUs and support chips. Therefore, these games
are NOT simulations, but the actual, original games that appeared in arcades.

MAME's purpose is to preserve these decades of video-game history. As gaming
technology continues to rush forward, MAME prevents these important "vintage"
games from being lost and forgotten. This is achieved by documenting the
hardware and how it functions, thanks to the talent of programmers from the
MAME team and from other contributors. Being able to play the games is just
a nice side-effect, which doesn't happen all the time. MAME strives for
emulating the games faithfully.

MAME has been merged with MESS, a "Multiple Emulator Super System" that emulates old video game consoles and micro computers. So all the code is now inside MAME and the RPM description is slightly incomplete in that it only mentions arcade machines. Arcade machines were huge, coin operated gaming machines that you played if you had money. MAME aims to preserve old hardware in the form of software, i.e. emulation. MAME emulates lots of machines!

To install MAME on Fedora Linux 27, as root, you would issue the simple command:

dnf -y install mame

I had already used MAME for Colecovision retroconsole emulation and it worked fine. I was hoping Amstrad CPC emulation would work too. First, I downloaded a Bruce Lee disk image for Amstrad. I do not remember where I got it from and I did not know whether the disk image was good at all, but that was all I had. By the way, I am a lawful owner of Bruce Lee Amstrad floppy disk, so I did not even violate any copyright laws by downloading Bruce Lee. I bought the disk from eBay in 2017.

After leeching the disk image, I googled for advice on how to start the Amstrad CPC emulation using MAME. I came across the command:

mame cpc6128 -window -flop1 whatever.dsk

Seemed easy enough. The switch -flop1 was clearly for virtually inserting whatever.dsk floppy disk image into the first virtual floppy drive. That was exactly what I needed. I had never heard of CPC 6128, I only knew CPC 464, so I modified the command to be:

mame cpc464 -window -flop1 bruce_lee.dsk

But it did not work, I got an error message saying:

Error: unknown option: -flop1

I figured out that maybe CPC 464 only had support for tapes. So I tried CPC 6128 with:

mame cpc6128 -window -flop1 bruce_lee.dsk

Well, MAME failed to start, for obvious reasons given in the terminal window:

Joystick: Start initialization
Input: Adding joystick #0: LogitechLogitechRumblePad2USB (device id: LogitechLogitechRumblePad2USB)
Joystick: Logitech Logitech RumblePad 2 USB
Joystick: ... 4 axes, 12 buttons 1 hats 0 balls
Joystick: ... Physical id 0 mapped to logical id 1
Joystick: End initialization
Searching font Liberation Sans in -/usr/share/mame/fonts path/s
Matching font: /usr/share/fonts/liberation/LiberationSans-Regular.ttf
OpenGL: VBO supported
OpenGL: PBO supported
OpenGL: FBO supported
OpenGL: using vid filter: 1
Input: Autoenabling mouse due to presence of a mouse
Input: Autoenabling mouse due to presence of a mouse
Region ':maincpu' created
cpc6128.rom NOT FOUND (tried in cpc6128 cpc464 cpc6128)
cpcados.rom NOT FOUND (tried in cpc6128 cpc464 cpc6128)
Fatal error: Required files are missing, the machine cannot be run.
sdl_kill: closing audio
Enter sdlwindow_exit
Leave sdlwindow_exit

MAME does not ship with ROM images for copyright reasons. It contains only the code to emulate the hardware, so the ROM files need to be leeched from the Internet and provided for MAME to use.

CPC 6128 emulation is not an exception to this. Amstrad CPC 6128 computer emulation requires the system ROMs in order to work, just like the real machine. The system ROMs contain the operating system routines for Amstrad, character graphics etc. So I googled again and leeched cpc6128.zip. Next I had to figure out where to put it. Just like with Colecovision earlier, I did:

grep roms /etc/mame/mame.ini

and got the response:

rompath /usr/share/mame/roms;/usr/share/mame/chd

So the ROMS should be under /usr/share/mame/roms. As a root user, I issued the commands:

mkdir /usr/share/mame/roms/cpc6128
cp -iv cpc6128.zip /usr/share/mame/roms/cpc6128

And tried to start MAME. It failed again. MAME could not find the ROM images from inside the ZIP-file, so I unpacked it:

cd /usr/share/mame/roms/cpc6128
unzip cpc6128.zip

After that MAME found all the Amstrad system ROMs it needed and Amstrad CPC 6128 emulation was up and running. Nice, that was easy!

amstrad 01

I then googled for advice on how to actually use this Amstrad! I did not know anything about it. I found out that the command cat exists on Amstrad too, although it does different things compared to its Unix/Linux counterpart. On Unix, "cat", stands for "conCATenate", but on Amstrad, "cat" probably means "catalog". On Amstrad, it displays the contents of the floppy disk like this:

amstrad 02

To LOAD and RUN programs from the floppy disk, you give command run" followed by the program name. So for Bruce Lee, I made a wild guess that bruce.bas is the BASIC loader for Bruce Lee. Hoping for the best I issued the following command:

amstrad 03

For my delight, it worked right away and Bruce Lee started loading:

amstrad 04

I was patient and waited for a while for the game to be loaded. Finally Bruce Lee was completely loaded and ready to be played:

amstrad 05

Here is the first screen in action:

amstrad 06

Notice that MAME had earlier recognized my USB controller as joystick #0 and it worked like a charm in Bruce Lee, I did not have to do anything to configure it. This is what MAME said when starting up:

Input: Adding joystick #0: LogitechLogitechRumblePad2USB (device id: LogitechLogitechRumblePad2USB)
Joystick: Logitech Logitech RumblePad 2 USB
Joystick: ... 4 axes, 12 buttons 1 hats 0 balls
Joystick: ... Physical id 0 mapped to logical id 1
Joystick: End initialization

Based on my initial experiences playing just the first few screens, this Amstrad port of Bruce Lee seems a bit harder than the Commodore 64 version. On Amstrad the ninja seems more aggressive and tougher to beat. But I am not sure, I have played this version for only a few minutes now.

Hopefully this brief tutorial showed you how to use MAME to emulate Amstrad CPC 6128 on Linux.