Turn Your Original Raspberry Pi into a ZX Spectrum Computer With ZXBaremulator

The ZX Spectrum computer was 40 years old in 2022. Released in the UK and Europe around the same time as the Commodore 64, this British-built budget home computer contributed hugely to the nascent computing and games industry. These days, ZX Spectrums are rare, but they can be emulated.

A British-built computer that you may be more familiar with is the Raspberry Pi. You could install an emulator on Raspberry Pi OS to run ZX Spectrum software, or you could try something different: a bare metal emulator like ZXBaremulator.

When running software for other platforms on a computer, the typical solutions are a virtual machine, or emulation.

Both methods require an underlying operating system, such as Windows, or Linux, to “host” the virtualization or emulation software. With bare metal emulation, however, the emulated or virtualized environment runs without an OS.

This has various advantages, not least reduced latency. It also means that the emulated environment can boot far quicker than it can when “piggybacking” the usual OS.

What Is a ZX Spectrum Computer?

An 8-bit computer released in 1982, the ZX Spectrum sold 5 million units until its retirement in 1992. While recognizable by the rainbow motif on the original and subsequent models, few original ZX Spectrum computers made it to the USA. Instead, licensed clones were produced, such as the Timex T/S 2068. Elsewhere, such as in Eastern Europe, Russia, and south-east Asia, unofficial clones were released.

As with most 8-bit systems, the ZX Spectrum mainboard is housed in a case with a top-mounted keyboard. This differs in having as few keys as possible (rubber buttons, rather than keys) and offering a bunch of shortcuts for programming commands.

Data can be loaded or saved to cassette tapes, a smaller magnetic tape cartridge (using a device called the “Microdrive”) or on later models, a 3-inch CF2 (“Compact Floppy Disk”).

Many big name games were adapted for the ZX Spectrum. Movie tie-ins such as 1989’s Batman: The Movie (named to distinguish it from an earlier DC-licensed game), Capcom coin-op Ghosts’n’Goblins, and even space exploration classic Elite (the progenitor of Elite Dangerous) were all released on the ZX Spectrum.

All this despite the computer being able to handle multicolored sprites and games often lacking music.

Which Raspberry Pi Does ZXBaremulator Run On?

Any Raspberry Pi up to and including the Raspberry Pi 3 B+ can run ZXBaremulator. So, whether you have an original Raspberry Pi A or B, or even a Raspberry Pi Zero, you can all-but turn your Pi into a ZX Spectrum.

For this guide, I’ve installed ZXBaremulator on an original Raspberry Pi. The computer has been languishing in my drawer for years (since the release of the Raspberry Pi 2, in fact). I’ve been looking for a use that isn’t too taxing on the old board, and this looks like the ideal project.

Why Not Use an Emulator on Raspberry Pi OS?

Various ZX Spectrum emulators are available. Specifically compatible with the Raspberry Pi are:

  • Fuze — “Free Unix Spectrum Emulator”
  • ZesarUX — also emulates various ZX Spectrum clones and other platforms, such as Sega Master System

Using one of these emulators on your Raspberry Pi OS is fine. In fact, you should notice little difference in performance. If your Raspberry Pi’s current operating system is set up the way you like it, there is no need to erase it with ZXBaremulator. Instead, just install an emulator.

But if you’re interested to see how a bare metal ZX Spectrum emulator runs on the Raspberry Pi, follow the steps below.

How to Install ZXBaremulator on Raspberry Pi

Before starting, ensure you have a compatible Raspberry Pi model and suitable SD card, formatted in FAT. You should also have a USB keyboard attached; do this before powering on or else the device will not be detected (the same goes for your game controller). You should also have the Raspberry Pi connected to a suitable display.

  • Start by heading to zxmini.speccy.org and downloading allfiles.zip (linked to “All files needed in a ZIP file”).
  • Next, grab the optimized kernel.img file for your model. Three options are available, depending on whether your Pi is an ARMv6, ARMv7, or ARMv8 model.
  • Extract the allfiles.zip into a new directory on your computer. You’ll notice it already has a kernel.img file — replace this with the one optimized for your Pi (simply copy and paste).
  • You can then copy those files (there should be 18) to the root of your formatted SD card. Accompanying these should be any ZX Spectrum TAP or TZX files you wish to run on the Raspberry Pi. You’ll have to source these yourself, but you will find hundreds of brand new, modern, original ZX Spectrum games to play free or buy at itch.io/games/tag-zx-spectrum.

Once this is done, eject the card, insert it in your Raspberry Pi, and boot it up.

Using ZXBaremulator to Run ZX Spectrum Programs

Using ZXBaremulator if you’re not familiar with the ZX Spectrum is made simpler with a pair of help screens.

The first, F1, is used for selecting TAP files (more on that below). The second, ALT + K, provides a visual reference of the ZX Spectrum’s keyboard. Hit ESC in any of these screens to return to whatever is being emulated.

By default, the keys default to the commands printed on them rather than the corresponding letter. This is very useful, but can take some getting used to.

You can input a basic program to get used to the keyboard.

  1. Type “10” then SHIFT + P (Print)
  2. Press CTRL + P (“) then enter a message (e.g. “Hi, I’m a Raspberry Pi”) and CTRL + P again to close the quotes
  3. Hit Enter to start a new line
  4. Type “20” then SHIFT + G (GO TO)
  5. Press R (RUN)
  6. Hit Enter to run the program

The basic text loop you entered will stop after a screen-full of lines, asking if you wish to stop or continue. If you choose the latter, you can end it later by pressing the keyboard’s Pause button.

To launch a TAP file, once the ZXBaremulator has booted into the ZX Spectrum, tap F1 to find the menu screen. With your keyboard’s arrow keys, select the game you wish to load, and tap SPACE.

Next, press F1 again to return to the command line. Here, press:

  1. CTRL + J (LOAD)
  2. CTRL + P twice (“”)
  3. Then hit Enter

The game should begin loading. You can play with the keyboard, or any controller that was plugged in when the Raspberry Pi was powered on. Standard USB controllers will work, along with PS4, Xbox 360, Xbox One, and Nintendo Switch Pro controllers.

At any point during the game you can use the two hotkeys to open the ZXBaremulator help screens.

More 8-Bit Emulation With the Raspberry Pi

At this point, you have everything you need to run software or program your emulated ZX Spectrum. There is no underlying Linux operating system to contend with, and no latency. Aside from getting your hands on an original ZX Spectrum, this is the closest you’re going to get to its authentic 40-year-old computing experience.

Of course, this isn’t the only retro gaming platform you can emulate on a Raspberry Pi.

Source link

Leave a Reply

Your email address will not be published. Required fields are marked *