RetroLab

Classic Games, Retro Gaming Reimagined

Understanding and rewriting the emulation of 1980s arcade cabinets, chip by chip, in modern Object Pascal, as code that both humans and AIs can read and reuse.

The games

The RetroLab cabinet menu: seven arcade games, ready to play

Xbox gamepad or any XInput gamepad, or the keyboard; controls can be rewired with F1. Click a game to open its board in the architecture.

Architecture

The code follows the real machine. Each part is a Pascal unit, and each unit only knows its direct neighbours.

The cabinet

window, speaker, gamepads, menu

samples/Cabinetsrc/cabinet

The connector

player inputs in, picture and sound out, one frame at a time

Arcade.Board

The board

the wiring: memory, interrupts, video

src/boards

The chips

CPUs and sound, with no dependency

src/chips

The cartridge

which ROM files, at which address, for which board. Generated from MAME, every file checked by its CRC32.

src/romsets

The boards and their chips

Pick a board: its chips light up. Pick a chip: the boards that use it light up.

Boards

Chips

Picture fidelity

An OutRun frame as the cabinet computes it, then the layers it is made of. Each layer comes from the same code as in the game, simply shown alone.

OutRun: the full picture, road, background, sprites and text
The final picture, 320 × 224, unfiltered.
The road layer
1. The road. The sky is filled line by line by the road chip. Then two roads, mixed by the priority table of the original PAL: that is the fork.
The tile layers
2. The backgrounds. Two System 16B tile layers: a 1024 × 512 window over 4 of 16 pages, scrolling per line and per column.
The sprites
3. The sprites. Read from the double buffer, zoomed as the chip does it (steps of 1/512), with flipping, priority and shadow pixels.
The text layer
4. The text. A 64 × 28 character grid, above the backgrounds; sprites go in front of it or behind it depending on their priority.

Computing fidelity

This is a work in progress. What comes next is described in the roadmap.

Get started

1. ROMs: you provide them

No ROM is provided. Use your own MAME sets, in a roms/ folder at the root of the repository.

GameFileMAME set
1942roms/1942.zip1942 (Revision B)
Commandoroms/commando.zipCommando (World)
Gun.Smokeroms/gunsmoke.zipGun.Smoke (World, 1985-11-15)
1943roms/1943.zip1943: The Battle of Midway (Euro)
Ghosts'n Goblinsroms/gng.zipGhosts'n Goblins (World? set 1)
OutRunroms/outrun.zipOut Run (sitdown/upright, Rev B)
Power Driftroms/pdrift.zipPower Drift (World, Rev A)

2. Build

Open samples/Cabinet/Cabinet.dpr in Delphi and compile for Win64. Every unit is listed in the .dpr, so there is nothing else to configure. The project is developed with Delphi 13.

3. Run

Cabinet.exe: a menu lists the games, ready or with their ROM missing. Cabinet.exe --set commando starts a game directly.

4. Cabinet settings

The boards' DIP switches (difficulty, lives, coinage) are set from the command line, as a hexadecimal value per bank: --dip0 XX and --dip1 XX. The --service option starts the board in its test mode.

GameDefaultEasyHardHardest
Power DriftEA--dip0 AA--dip0 6A--dip0 2A
OutRun, trafficF9--dip0 B9--dip0 79--dip0 39

In OutRun, --dip0 A9 gives both an easy time limit and light traffic. For Power Drift, --dip0 EB turns the cabinet into the moving model: the game drives the seat, and its roll comes through the gamepad vibrations.