Wednesday, April 17, 2024

The RP2040 ZX Spectrum emulator has just been released

The ZX2040 is a port of Andre Weissflog ZX Spectrum emulator to the Raspberry Pico RP2040, packed with a simple UI for game selection and key mapping to make it usable without a keyboard.

This project is specifically designed for the Raspberry Pico and ST77xx based displays. The reference device is the Pimoroni Tufty RP2040 display board, but actually the code can run into any Raspberry Pico equipped with an ST77xx display and five buttons connected to five different pins. The buttons work as inputs for the four gaming directions (left, right, top, bottom) and the fire button.

Main features

  • Pico -> Spectrum key mapping with each pin mapped up to two Spectrum keys or Kempstone joystick moves. Each game has its own key map, taking advantage of mapping to make games easier to play on portable devices: for instance Jetpac maps a single key (down key) to up + fire. Key macros are used in order to automatically trigger key presses when given frames are reached, to select the kempstone joystick, skip key redefinition, and other things otherwise impossible with few buttons available on the device.
  • minimal ST77xx display driver is included, written specifically for this project. It has just what it is needed to initialize the display and refresh the screen with the Spectrum frame buffer content. It works both with SPI and 8-wires parallel interfaces and is optimized for fast bulk refreshes.
  • The emulator has an UI that allows to select games into a list, change certain emulation settings and so forth.
  • Multiple games included, with a script to easily added more (see section about adding games). Important, I included copyrighted games hoping that’s fair-use, since these games are no longer sold. If you are the copyright owner and want the game to be removed, please open an issue or write me an email at antirez at google mail service.
  • 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.
  • Crazy overclocking to make it work fast enough 😀 Warning: the code must run from the Pico RAM, and not in the memory mapped flash, otherwise it’s not possible to go at 400Mhz. This is achieved simply with pico_set_binary_type(zx copy_to_ram) in CMakeList.txt. There are no problems accessing the flash to load games, because the code down-clocks the CPU when loading games, and then returns at a higher overclocking speeds immediately after.

See more on the project GitHub page. Under an MIT license.

No comments:

Post a Comment