Note: This is a fork of the original zx2040 by Salvatore Sanfilippo, which itself is a port of Andre Weissflog's emulator. This version has been specifically adapted to run on the PicoCalc hardware. All credit for the powerful core emulator goes to the original authors.
Video demo here.
zx-picocalc is a port of the zx2040 ZX Spectrum 48k emulator, modified to run correctly on the PicoCalc handheld.
It features a simple UI for game selection, emulates the Kempston joystick and makes use of a full PicoCalc keyboard, allowing not only for playing classic ZX Spectrum games but also programming in 48 BASIC.
- UI that allows to select games into a list, change certain emulation settings and so forth.
- Easy games upload, with a script to create a binary image of Z80 games and transfer it into the Pico flash.
- Full Spectrum keyboard support, with all Caps Shift, Symbol Shift and Extended Mode combinations working. PicoCalc-specific keys, e.g. F1-F10, Tab, Back had been mapped to ZX keys for more comfortable operation.
- Kempston Joystick emulated in two ways: with arrow keys +
F5for fire and with an output for an actual joystick, connected to the input on left side of PicoCalc. - Real time upscaling and downscaling of video, to use the emulator with displays that are larger or smaller than the Spectrum video output. The emulator is also able to remove borders.
- Tufty -> Spectrum key mapping had been disabled. PicoCalc does offer a full keyboard so it was not a priority while made debugging much easier.
- Crazy overclocking to make it work fast enough on RPi 2040 :D
- Download: Go to the Releases page and download the latest
zx-picocalc.uf2file. - Bootloader Mode: Connect your PicoCalc with a computer with a micro USB port (not USB-C) while holding the
BOOTSELbutton. On a PicoCalc this button is available on the back, through the vents, marked with tinyresettext. The device will appear on your computer as a USB drive namedRPI-RP2. - Flash: Drag and drop the downloaded
.uf2file onto theRPI-RP2drive. The device will reboot automatically.
There are two ways to add the snapshot files with software/games: with an SD card and (legacy) by uploading them to Pico flash.
The SD card way is more convenient and allows for using uf2loader by pelrun! Unfortunately, on RP2040 aka Pico 1 only smaller games may be loaded that way at the moment.
- Save one or several .z80 files into /zxspectrum folder on a SD card compatible with your Picocalc. For your convenience, "0BASIC.z80" file is included. It's an empty snapshot, going right into a 48BASIC on your Picocalc.
- Insert the card to the Picocalc
- Turn it on
- Connect your PicoCalc, again in bootloader mode (micro USB while holding the
BOOTSELbutton). - Enter the
gamesdirectory in this repository. - Copy your .Z80 game files into the games/Z80 subdirectory.
- Run the
./loadgames.pyscript. This will bundle the games and keymaps and upload them to the Picocalc's flash. This script requires Python installed on your machine. - Disconnect USB cable
The UI of zx picocalc is a simple menu, displayed in the top right corner. It allows for loading software and changing some runtime emulator parameters.
Esc: Enter / Exit the menu.- Note: exiting the menu that way will leave an artifact (black rectangle) on the screen. This has to be that way in order to preserve limited RAM of RPi2040.
Up/Down: Select a game or a parameterLeft/Right: Change parameter valueEnterorF5/Fire: Load the game and exit the menu. Pressed on a current game reloads it.
Up/Down/Left/Right/F5on a PicoCalc keyboard: Kempston joystick emulation. Remember to first select Kempston Joystick option in a game.F1:Edit(Shift-1 on ZX Spectrum)F2, Tab:Extend Mode(Shift-Symbol Shift on ZX Spectrum)F3:Cursor Left(Shift-5 on ZX Spectrum)F4:Cursor Right(Shift-8 on ZX Spectrum)F6:Graphics(Shift-9 on ZX Spectrum)F7:Caps Lock(Shift-2 on ZX Spectrum). This is separate from CapsLK on PicoCalc keyboard!F8:True Video(Shift-3 on ZX Spectrum)F9:Inv Video(Shift-4 on ZX Spectrum)Del, Back:Delete(Shift-0 on ZX Spectrum)Shift-Up/Shift-Down:Cursor Up/Down(Shift-6/7 on ZX Spectrum)0-9 and QWERTY keys: regular ZX Spectrum keys with keywords, letters, symbols available as on ZX SpectrumShift(the green one):Picocalc Shift- lowecase letters and symbols marked green on the PicoCalcCtrl:ZX Shift- lowercase letters and symbols marked white over numeric keys on a ZX Spectrum keyboardAlt:Symbol Shift- symbols and keywords marked red on a ZX Spectrum keyboard
Regular Atari-style joystick, the one with 9-pin D connector, as used in the 80s can be connected to GPIO ports on the side of PicoCalc.
Connections are as follows:
GP2: Joystick Left -> D9 Pin 3GP3: Joystick Right -> D9 Pin 4GP4: Joystick Up -> D9 Pin 1GP5: Joystick Down -> D9 Pin 2GP21: Joystick Fire -> D9 Pin 6GND: To be connected with above GPIOs -> D9 Pin 8
I want to thank Salvatore Sanfilippo for writing zx2040 in a way that even I 😉 could easily understand. And to Andre Weissflog for writing the original code.
If you build from sources:
- Install
picotool(pip install picotool, or alike) and the Pico SDK. - Try building one of the example projects included in Pico SDK first. If you cannot build
hello_usbthen you won't be able to buildzx-picocalc. Ask me how I know. - Create a
device_config.hfile in the main directory. For the PicoCalc just docp devices/picocalc.h device_config.h. - Compile with:
mkdir build; cd build; cmake ..; make. - Transfer the resulting
zx.uf2file to your Pico (put it in boot mode pressing the boot button as you power up the device, then drag the file in theRPI-RP2drive you see as a USB drive).
All the code here MIT licensed, so you are free to use this emulator for commercial purposes. Feel free to sell it, put it as example in your boards or whatever you want to do with it. However please note that games you find in the wild are often copyrighted material and are not under a free license. Either use free software games with a suitable license (there are new games developed for the Spectrum every year, very cool ones too: pick the ones with a suitable license), or ask permission to the copyright owners. In any case, you will be responsible for your actions, not me :).
About the ZX Spectrum ROM included in this repository, this is copyrighted material, and the current owner is the Sky Group, so if you want to do a commercial product using this code using also the ROM, you need to contact Sky Group. This is what happened so far:
- The original owner was Sinclair, that was sold to Amstrad.
- Amstrad agreed that having the ROMs as parts of NON commercial use was fair use. That's really cool, and one of the reasons why Spectrum emulators are legal.
- Then Amstrad was sold to the Sky Group. Apparently the ZX Spectrum Next has official permission from the Sky Group to use the ROM. So the position of the Sky Group is yet very open.
- However if you want to make anything commercial with the ROM, you need an official written permission. If you want to use this emulator without the ROM, to run a snapshot image that does not use any code inside the ROM, you can just discard the ROM file, and use this emulator for any purpose.