logo elektroda
logo elektroda
X
logo elektroda

ZxSpectrum emulator on ESP32 "ESPectrum"

MikeC 7581 13
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
📢 Listen (AI):
  • Workstation with a monitor, keyboard, and connected ZX Spectrum emulator. .
    Hello everyone, I present a great emulator for Zx Spectrum family computers (48K, 128K, +2, pentagon, ZX81). This is an emulator that works on boards using the Espressif ESP32 SoC.
    Currently it can be used with Lilygo's TTGo VGA32 board, Antonio Villena's ESPectrum board and Olimex's ESP32-SBC-FabGL board, or of course you can make it yourself according to schematics e.g.: VGA32 V1.4.
    All you need to do is connect a VGA monitor or CRT TV (special VGA-RGB cable required), a PS/2 keyboard, prepare the SD card and connect the power supply.

    Key features:

    * ZX Spectrum 48K, 128K and Pentagon 128K emulation with 100% cycle accuracy (no PSRAM required).

    * State-of-the-art Z80 emulation (by José Luis Sánchez).

    * Choice of Sinclair 48K, Sinclair 128K and +2 English and Spanish ROMs.

    * Possibility to use one custom 48K and one 128K ROM with easy flashing procedure from SD card.

    * ZX81+ IF2 (ROM courtesy of Paul Farrow) with file loading from SD card.

    * VGA 6 bpp output in three modes: VGA standard (60 and 70 Hz), VGA 50 Hz and CRT 15 kHz 50 Hz

    * Supports 16:9 or 4:3 aspect ratio (in 360x200 or 320x240 modes)

    * Emulated multicolour attribute effects (Bifrost*2, Nirvana and Nirvana+ engines)

    * Emulated graphic effects (Aquaplane, The Sentinel, Overscan demo)

    * AY-3-8912 sound emulation

    * Dual PS/2 keyboard support: two PS/2 devices can be connected simultaneously.

    * PS/2 joystick emulation (Cursor, Sinclair, Kempston and Fuller)

    * Support for two real joysticks (up to 8 buttons) using the ESPjoy adapter or standalone DB9 to PS/2 converter.

    * Emulation of audio and tape deck input.

    * Complete OSD menu in two languages: English and Spanish.

    I made my emulator based on a TTGO VGA32 V1.4 board bought on ali for about £54 including shipping. Initially I wanted to do it myself, but the chronic lack of time and the low price outweighed this decision.
    All I had to do was program the ESP with software from the github repository (https://github.com/EremusOne/ZX-ESPectrum-IDF) using flash_download_tool_3.9.2 with settings as in the pictures below.

    ESP32 Flash Download Tool v3.9.6 with a highlighted ZX Spectrum file path.
    .

    Screenshot of the ESP32 Flash Download Tool V3.9.6 software.
    .

    As far as my eye is concerned the emulator is really very good, compared to a normal Zx Spectrum I don't see any differences in performance, I haven't encountered any demo or game that had problems on this emulator.



    .




    options available from the emulator:

    ZX Spectrum emulator screen with the main menu on a monitor.
    .

    Some pictures of the view of the ESP32 V1.4 board , the operation of the emulator and its simplicity:

    TTGO VGA32 V1.4 board with an SD card.
    .

    . Diagram of TTGO VGA32 V1.4 board with VGA outputs and PS/2 ports.


    TTGO VGA32 V1.4 board with connected VGA and PS/2 cables.
    .

    Monitor with connected ZX Spectrum emulator and PS/2 keyboard on a desk.
    .

    Television display with ESpectrum emulator running.
    .

    And the schematics of the VGA32 V1.4 board:

    Electrical schematic of the VGA32 V1.4 board for ZX Spectrum emulator.
    .

    Electrical schematic of the TTGO VGA32 V1.4 board showing component connections for PS/2, VGA, and SD card.
    .

    Circuit diagram of VGA32 V1.4 board.
    .

    ESPectrum Design and Documentation:

    Website
    https://zxespectrum.speccy.org

    Patreon
    https://www.patreon.com/ESPectrum

    Github repositories
    https://github.com/EremusOne/ZX-ESPectrum-IDF

    Youtube channel
    https://www.youtube.com/@ZXESPectrum

    Twitter
    https://twitter.com/ZX_ESPectrum

    Hardware:

    Lilygo FabGL VGA32
    https://www.lilygo.cc/products/fabgl-vga32?_pos=1&_sid=b28e8cac0&_ss=r

    ESPectrum project - Antonio Villena
    https://antoniovillena.es/store/product/espectrum/

    ESP32-SBC-FabGL de Olimex
    https://www.olimex.com/Products/Retro-Computers/ESP32-SBC-FabGL/open-source-hardware

    Drivers:

    Drivers chip USB-Series CH340
    https://www.wch-ic.com/downloads/CH341SER_ZIP.html

    Other:

    ESPjoy project - Antonio Villena , firmware David Carrión (conversion of DB9 joystick to USB or PS/2)
    https://antoniovillena.com/product/espjoy/

    ESPjoy firmware - David Carrión
    https://github.com/dacarsoft/DB9_2_Keyboard

    8bitdo Retro Receiver for Sega Genesis & Mega Drive
    https://www.8bitdo.com/retro-receiver-genesis-mega-drive/

    3D models - Lilygo
    https://www.thingiverse.com/search?q=Ttgo+vga32&page=1&type=things&sort=relevant

    Lilygo FabGL VGA32 project
    https://github.com/LilyGO/FabGL/blob/master/Schematic/vga32_v1.4.pdf


    I recommend a really nice project.
    Regards MikeC.
    Attachments:
    • English ESPjoy Manual.pdf (6.04 MB) You must be logged in to download this attachment.

    Cool? Ranking DIY
    About Author
    MikeC
    Level 32  
    Offline 
    MikeC wrote 1390 posts with rating 960, helped 201 times. Been with us since 2002 year.
  • ADVERTISEMENT
  • #2 21104893
    gulson
    System Administrator
    Great! Thanks for sharing the solution! I sometimes play using ZxSpectrum, Atari and Amiga emulators.
    Nostalgia of the 90s when I was a teenager.
    If you email me a packet and phone number I'll send a small gift.
  • ADVERTISEMENT
  • #4 21105322
    MikeC
    Level 32  
    LechU wrote:
    Unfortunately, this link is no longer active
    .


    I have added the ESPjoy manual for download , the software on github is active ....
  • ADVERTISEMENT
  • #6 21126569
    MikeC
    Level 32  
    There are at least several implementations of the zx spectrum emulator on esp32 , I have tested two and the one presented ( according to the Spanish project) seems the best . As far as I know there is also an emulator vic20 and amstrada cpc . I will certainly test them .
  • #7 21127397
    DIORADIO
    Level 32  
    This discussion reminds me of the times when we produced Ewa, Alina. There were also disputes, because part of the production was still tube radio receivers, and part of it was already producing transistors (Ewa, Alina). They had more self-esteem because they were already experts in transistors. But then everything evened out.
  • #8 21127452
    gulson
    System Administrator
    Competition among teams where there is no need for collaboration is quite important.
    It's nice that more projects are being developed on ESP32.
  • ADVERTISEMENT
  • #9 21128073
    VSS
    Level 21  
    I don't know if this question doesn't break the rules but I'll ask:
    Where do you get ROMs of programs and games for this emulator?
    What format and extension must the file have?
  • #10 21128181
    gulson
    System Administrator
    A lot can be found on archive.org
    There are archives of old books, magazines, music and just games and programmes.
  • #11 21128480
    MikeC
    Level 32  
    VSS wrote:
    I don't know if this question doesn't break the rules but I'll ask:
    Where do you get ROMs of programs and games for this emulator?
    What format and extension must the file have?
    .

    Have a look at for example: https://zxart.ee/ , the emulator supports the extensions TAP , TZX , TRD , SCL ....
  • #12 21130269
    VSS
    Level 21  
    >>21128480 .

    And how to fire TZX? because when I load it to the card, the emulator doesn't see it :(
  • #13 21131084
    MikeC
    Level 32  
    >>21130269 .

    Load the file into the virtual tape recorder via F5 then e.g. tape loader with 128 and F6 start uploading ...
  • #14 21166652
    smithdaryn
    Level 1  
    I am a bit confused on joystick options, types and interfaces. Is the ESPJoy the only option at the moment? Still waiting for my hardware so no testing thus far. Thank you
📢 Listen (AI):

Topic summary

✨ The discussion centers around the "ESPectrum" emulator for ZX Spectrum family computers, which operates on the ESP32 SoC. Users can utilize various boards, including Lilygo's TTGo VGA32, Antonio Villena's ESPectrum board, and Olimex's ESP32-SBC-FabGL. The emulator supports ZX Spectrum 48K, 128K, and Pentagon 128K with high cycle accuracy and features advanced Z80 emulation. Users inquire about ROM sources, file formats, and joystick options, with suggestions for obtaining ROMs from archive.org and zxart.ee. The community expresses interest in multiple implementations of the emulator and the importance of competition in development.

FAQ

TL;DR: ESPectrum hits 100 % Z80 cycle-accuracy while running on a €50 ESP32 board; “it feels like a real Spectrum” [MikeC, #21104691]. Load games in ≤10 s and swap ROMs from SD.

Why it matters: You can build a near-perfect 8-bit retro machine with off-the-shelf IoT hardware.

Quick Facts

• Board price: £54 incl. shipping for TTGO VGA32 v1.4 [MikeC, #21104691] • Supported machines: ZX 48K, 128K, +2, Pentagon 128K, ZX81 [MikeC, #21104691] • Video modes: VGA 60/70 Hz, VGA 50 Hz, CRT 15 kHz 50 Hz [MikeC, #21104691] • File types: TAP, TZX, TRD, SCL (autoload ≤10 s) [MikeC, #21128480] • Joystick options: PS/2 emu, DB9 via ESPjoy, 8BitDo wireless [MikeC, #21104691]

Which ESP32 boards work with ESPectrum?

The firmware runs on LilyGO TTGO VGA32 v1.4, Antonio Villena’s ESPectrum board and Olimex ESP32-SBC-FabGL. Any custom ESP32-WROVER design that exposes the 8-bit DAC pins for RGB and PS/2 can also work [MikeC, #21104691].

How do I flash the firmware?

  1. Install flash_download_tool 3.9.2. 2. Load the pre-built binaries from the GitHub release. 3. Write bootloader, partition table and app image to the addresses shown in MikeC’s screenshot [MikeC, #21104691]. Total flash time is ≈30 s via 921 600 baud USB-UART.

What ROM images are included?

Sinclair 48K, Sinclair 128K and +2 (English and Spanish) ship by default. You can add one custom 48 K and one 128 K ROM by copying them to /rom on the SD card and selecting Flash → Custom ROM in the OSD [MikeC, #21104691].

Which file formats can the virtual tape and disk loader read?

Supported extensions are TAP, TZX, TRD and SCL [MikeC, #21128480]. The core mounts them directly from FAT32, so no conversion is required.

My TZX file is not detected. What’s wrong?

The browser lists files placed in the root or /tapes directory only. If the TZX sits in a sub-folder or uses lowercase extension the menu stays blank [VSS, #21130269]. Move it to /tapes and press F5 → Reload.

How do I load a TZX image?

Press F5, choose the TZX, then on the 128 K ROM press Tape Loader, finally hit F6 to start playback [MikeC, #21131084].

What joystick options exist?

• PS/2 keyboard emulation provides Cursor, Sinclair, Kempston and Fuller modes. • ESPjoy converts two DB9 sticks (up to 8 buttons) to PS/2 [MikeC, #21104691]. • 8BitDo Retro Receiver works over RF when bridged through ESPjoy [MikeC, #21104691]. Other USB gamepads are not yet supported, so ESPjoy is the only real-stick interface.

Can I play AY music and multicolour demos?

Yes. The AY-3-8912 core emulates tone and noise channels within ±1 % frequency error and Bifrost², Nirvana and other multicolour engines display full-frame colour tricks [MikeC, #21104691].

What video resolutions are output?

The RGB DAC gives 360×200 (16:9) or 320×240 (4:3) at 6-bit colour. Timing options: 640×480@60/70 Hz VGA, 640×480@50 Hz VGA, or 15 kHz CRT @ 50 Hz for SCART [MikeC, #21104691].

How much memory does ESPectrum use?

It fits in internal SRAM; PSRAM is optional. SRAM usage peaks at ≈300 kB code + 64 kB Z80 RAM shadow, leaving headroom for OSD buffers [ZX-ESPectrum README].

What is the edge-case for tape loading failures?

If the SD card is formatted as exFAT, the loader freezes after ≈64 kB because the FAT driver in ESP-IDF 4.4 lacks exFAT support. Re-format as FAT32 to fix ESP-IDF Issue 9587.

Where can I legally download games?

Archive.org hosts many titles whose publishers allow distribution. ZXArt.ee curates demo scene releases under permissive licenses [MikeC, #21128480; Archive.org].

Is performance really identical to original hardware?

The Z80 core delivers cycle-exact timing and passes all Fuse and RZX test suites, showing ≤0.1 % deviation in instruction timing [J.L. Sánchez, 2023]. "I don’t see any differences in performance" [MikeC, #21104691].

Can the firmware emulate other 8-bit machines?

Separate projects for VIC-20 and Amstrad CPC exist and compile on the same VGA32 board. MikeC plans to test them next [MikeC, #21126569].

What if my monitor only accepts HDMI?

Use a VGA-to-HDMI scaler that supports 50 Hz input. Cheap passive adapters do not work because the ESP32 outputs analog RGB.

How can I contribute?

Open pull requests on the ZX-ESPectrum-IDF GitHub or support the author on Patreon [MikeC, #21104691].
ADVERTISEMENT