This is an emulator of the Sinclair ZX Spectrum computer running on Espressif ESP32 SoC powered boards.
Currently, it can be used with Lilygo's TTGo VGA32 board, Antonio Villena's ESPectrum board and ESP32-SBC-FabGL board from Olimex.
Just connect a VGA monitor or CRT TV (with special VGA-RGB cable needed), a PS/2 keyboard, prepare a SD Card as needed and power via microUSB.
This project is based on David Crespo excellent work on ZX-ESPectrum-Wiimote which is a fork of the ZX-ESPectrum project by Rampa and Queru which was inspired by Pete's Todd PaseVGA project.
Features
- ZX Spectrum 48K, 128K and Pentagon 128K 100% cycle accurate emulation (no PSRAM needed).
- Perfect Z80 emulation (Authored by José Luis Sánchez)
- 6 bpp VGA output in three modes: Standard VGA (60 and 70hz), VGA 50hz and CRT 15khz 50hz.
- Support for two aspect ratios: 16:9 or 4:3 monitors (using 360x200 or 320x240 modes)
- Multicolor attribute effects emulated (Bifrost*2, Nirvana and Nirvana+ engines).
- Border effects emulated (Aquaplane, The Sentinel, Overscan demo).
- Floating bus effect emulated (Arkanoid, Sidewize).
- Contended memory and contended I/O emulation.
- AY-3-8912 sound emulation.
- Beeper & Mic emulation (Cobra’s Arc).
- Dual PS/2 keyboard support: you can connect two devices using PS/2 protocol at the same time.
- PS/2 Joystick emulation (Cursor, Sinclair, Kempston and Fuller).
- Two real joysticks support (Up to 8 button joysticks) using ESPjoy adapter or DIY DB9 to PS/2 converter.
- Emulation of Betadisk interface with four drives and TRD (read and write) and SCL (read only) support.
- Realtime and fast TAP file loading.
- TAP file saving to SD card.
- SNA and Z80 snapshot loading.
- Snapshot saving and loading.
- Complete file navigation system with autoindexing, folder support and search functions.
- Complete OSD menu in two languages: English & Spanish.
- BMP screen capture to SD Card (thanks David Crespo 😉).
Work in progress
- On screen keyboard.
- TZX support.
Installing
You can flash the binaries directly to the board if do not want to mess with code and compilers. Check the releases section
Compiling and installing
Quick start from PlatformIO:
- Clone this repo and Open from VSCode/PlatFormIO
- Execute task: Upload
- Enjoy
Windows, GNU/Linux and MacOS/X. This version has been developed using PlatformIO.
Install platformIO:
- There is an extension for Atom and VSCode, please check this website.
- Select your board, pico32 which behaves just like the TTGo VGA32.
Compile and flash it
PlatformIO > Project Tasks > Build
, then
PlatformIO > Project Tasks > Upload
.
Run these tasks (Upload
also does a Build
) whenever you make any change in the code.
Prepare micro SD Card
The SD card should be formatted in FAT16 / FAT32 and you must create the following folders in root directory:
- ".p" folder -> Will be used for persist snapshots.
- ".c" folder -> For BMP screen captures.
PS/2 Keyboard functions
- F1 Menu
- F2 Load (SNA,Z80)
- F3 Load custom snapshot
- F4 Save customn snapshot
- F5 Select TAP file
- F6 Play/Stop tape
- F7 Tape Browser
- F8 OSD Stats ( [CPU] microsecs per CPU cycle, [IDL] idle microsecs, [FPS] Frames per second, [FND] FPS w/no delay applied )
- F9 Volume down
- F10 Volume up
- F11 Hard reset
- F12 Reset ESP32
- Pause Pause
- PrntScr BMP screen capture (Folder /c at SDCard)
- CTRL + F1 Hardware info
- CTRL + F5..F8 Screen centering in CRT 15K/50hz mode
ZX Keyboard functions
Press CAPS SHIFT + SYMBOL SHIFT and:
- 1 Menu
- 2 Load (SNA,Z80)
- 3 Load custom snapshot
- 4 Save custom snapshot
- 5 Select TAP file
- 6 Play/Stop tape
- 7 Tape browser
- 8 OSD Stats ( [CPU] microsecs per CPU cycle, [IDL] idle microsecs, [FPS] Frames per second, [FND] FPS w/no delay applied )
- 9 Volume down
- 0 Volume up
- Q Hard reset
- W Reset ESP32
- P Pause
- S BMP screen capture (Folder /c at SDCard)
- I Hardware info
- Z, X, C and V Screen centering in CRT 15K/50hz mode
Hardware configuration and pinout
Pin assignment in hardpins.h
is set to match the boards we've tested emulator in, use it as-is, or change it to your own preference.
Thanks to
- David Crespo for his friendly help and support and his excellent work at his Youtube Channel and the ZX-ESPectrum-Wiimote emulator.
- Pete Todd, developer of the original project PaseVGA.
- Ramón Martínez "Rampa" and Jorge Fuertes "Queru" who improved PaseVGA in the first ZX-ESPectrum.
- Z80 Emulation derived from z80cpp, authored by José Luis Sánchez.
- VGA Driver from ESP32Lib by BitLuni.
- AY-3-8912 emulation from libayemu by Alexander Sashnov.
- PS2 Driver from Fabrizio di Vittorio for his FabGL library.
- Ackerman for his code and ideas.
- Azesmbog for testing and providing very valuable info to make the emu more precise.
- David Carrión for hardware and ZX keyboard code.
- ZjoyKiLer for his testing and ideas.
- Mark Woodmass and Juan Carlos González Amestoy for his excellent emulators and his help with wd1793 emulation.
- Antonio Villena for creating the ESPectrum board.
- Tsvetan Usunov from Olimex Ltd.
- Amstrad PLC for the ZX-Spectrum ROM binaries liberated for emulation purposes.
- Jean Thomas for his ESP32 APLL calculator.
And all the involved people from the golden age
- Sir Clive Sinclair.
- Christopher Curry.
- The Sinclair Team.
- Lord Alan Michael Sugar.
- Investrónica team.
- Matthew Smith for Manic Miner.
And all the writters, hobbist and documenters
- Retrowiki especially the people at ESP32 TTGO VGA32 subforum.
- RetroReal for his kindness and hospitality and his great work.
- Armand López El Viejoven FX
- Javi Ortiz El Spectrumero
- El Mundo del Spectrum
- Microhobby magazine.
- The World of Spectrum
- Dr. Ian Logan & Dr. Frank O'Hara for The Complete Spectrum ROM Disassembly book.
- Chris Smith for the The ZX-Spectrum ULA book.