Metal Slug runs on ZX Evolution with VDAC4: SNK’s Neo Geo classic, translated from 68000 machine code into C++ and executed natively on the ESP32-S3.
Metal Slug for ZX Evolution brings SNK’s arcade shooter to the TS-Config machine fitted with a VDAC4 graphics board. Marco Rossi, the SV-001 “Metal Slug” tank, the prisoners waiting to be rescued and General Morden’s troops all appear exactly as the Neo Geo artists drew them.
SNK released Metal Slug for the Neo Geo in 1996, and it grew into a long-running series. Players remember it for hand-drawn sprites, slapstick humour, scenery that breaks apart under fire and six missions that lead from jungle rivers and city streets to snowy peaks and Morden’s stronghold.
Native C++ instead of a 68000 emulator
No 68000 CPU is emulated on the board. The game’s machine code was disassembled and rewritten, first as Python and then as C++. Each original subroutine is now a C++ function, branches and loops have become ordinary if and while statements, and CPU registers and flags are plain variables. The result is roughly 10,700 functions that the ESP32-S3 runs like any other native program.
Accuracy is verified against a reference run, frame by frame: the game’s RAM and video memory stay identical for 20,000 frames. The arcade BIOS is not required either — a compact system layer written for the port takes over its duties.
Who does what on the VDAC4 hardware
- Z80 in the ZX Evolution runs the loader. It shows the splash screen with its progress bar, then serves SD card reads whenever the ESP32-S3 asks for data: compressed graphics travel straight to the FT812 emulator, and everything else goes to the ESP32-S3.
- ESP32-S3 on the VDAC4 board executes the game logic, mixes the audio and builds a display list for every frame.
- FT812 graphics controller emulator (Tang Nano 20K and BL616) decompresses the graphics directly into its own video memory and renders the image. The splash screen and the game both use a 1024 × 768 video mode.
How the Neo Geo graphics reach the screen
Every pixel comes from the original game. Neo Geo sprites and backgrounds are prepared ahead of time on a PC and packed into MSLUG.DAT as zlib-compressed banks; whenever a scene needs a bank, it is loaded into the FT812 emulator’s video memory. Each frame is then put together in five steps:
- Anatomy of a Neo Geo frame. The picture is made of 381 sprites plus a text layer. Each sprite is a vertical strip 16 pixels wide, built from 16 × 16 tiles, with its own position, height and horizontal and vertical shrink; Metal Slug assembles its backgrounds from the very same strips. The text layer holds 40 × 28 characters of 8 × 8 pixels, and colours come from 256 palettes of 16 entries.
- Sprite tables on the ESP32-S3. The translated game code writes the same sprite tables, text layer and palettes that it would write on real Neo Geo hardware.
- Strips prepared in advance. On the PC, every sprite strip has already been assembled from ROM tiles into a finished image, and its shrunk versions have been precomputed from the Neo Geo shrink table. Pixels are stored as colour indices, one byte each. The ESP32-S3 looks up the finished strip by its set of tiles; when there is none, the strip is drawn tile by tile.
- Building the display list. For every visible strip, the ESP32-S3 appends a rectangle to the FT812 emulator’s display list that says where the pixels are stored, which palette applies and where the strip lands on screen. Drawing order follows the Neo Geo rules: later sprites cover earlier ones and the text layer stays on top. Pieces that are completely hidden are skipped, and, as on the original hardware, no line shows more than 96 sprites.
- Rendering. The FT812 emulator draws the listed rectangles and turns the colour indices into real colours using the palettes of the current frame.
Graphics that usually show up on screen at the same time sit side by side in the DAT file. Banks therefore need to be fetched far less often, and the picture rarely has to wait for the SD card.
YM2610 soundtrack and effects
The game’s music and effects, originally produced by the YM2610 sound chip, were captured on a PC beforehand at 44.1 kHz and stored in the DAT as IMA ADPCM. At 4 bits per sample, that takes a quarter of the space of standard 16-bit audio. During play, the ESP32-S3 decodes the streams, mixes the music with up to eight effects at once and keeps the overall volume even.
Open the OPTION menu to set the MUSIC and SFX volume anywhere from 0 to 10; the difficulty level and the number of lives are adjusted on the same screen.
Keyboard and joystick controls
Both a PS/2 keyboard and a Kempston joystick are supported:
- Move: cursor keys, Q/A/O/P or the joystick.
- Shoot: Z, Space, Enter or the joystick fire button; outside gameplay the same keys act as Start.
- Jump: X, right Alt or the second joystick button.
- Throw a grenade: C, M or the third joystick button.
- Pause: Esc.
- Quit to Wild Commander: F12.
Performance on real hardware
Game logic ticks at 59 frames per second, matching the Neo Geo. On the board, the picture averages 52 frames per second across the first mission, while the busiest moments — the boss and big explosions — bring it down to 28–41 frames per second. Optimisation work is still in progress.
System requirements and installation
- Computer: a ZX Evolution running TS-Config.
- Video board: VDAC4 with the ESP32-S3 and the FT812 graphics controller emulator (Tang Nano 20K and BL616) at version 1.45 or newer, plus VDAC4 firmware 0.1.175 or newer.
- Storage: an SD card formatted as FAT32.
- Input: a PS/2 keyboard or a Kempston joystick.
- Install the files: place _MSLUG.SPG, MSLUG.ELF, MSCODE0.ELF … MSCODE4.ELF and MSLUG.DAT in the /GAMES/VDAC4/Metal Slug/ folder on your SD card.
- Launch: start _MSLUG.SPG from Wild Commander.
Open source on GitHub
Metal Slug for ZX Evolution was ported by Andrew Lazarev. The complete source of the port is public on GitHub, together with the tools that translate the 68000 code and convert the graphics and audio.
No ready-to-play game files are offered on this page. MSLUG.DAT and the MSCODE modules are generated from the Metal Slug ROM set (MAME mslug), which is the property of SNK.
Credits and acknowledgements
This port stands on the work of the following open projects:
- sp00nznet/metalslug — documentation of the NGH-201 board and game, plus the verification script;
- sp00nznet/neogeorecomp — the 68000 code analysis behind the game’s translation, a Neo Geo board model and the reference test bench;
- Musashi — reference 68000 core and disassembler used to verify the translation;
- superzazu/z80 — the Z80 sound CPU;
- ymfm — YM2610 sound chip core that the music and effects were recorded with;
- MAME — ROM set definitions used to validate the game files;
- libfoxenflac — streaming FLAC decoding;
- em_inflate — zlib decompression;
- Opus, opusfile, libogg, speexdsp — Opus decoding and resampling;
- ESP-IDF — the ESP32-S3 development framework.
Metal Slug and Neo Geo are the property of their rights holder, SNK.