Space Invaders
Games & Classics
The arcade classic, running live on the Super Nintendo — a marching fleet of three alien
kinds, falling bombs, destructible bunkers, a bonus UFO and a score/lives HUD, written in C on a small
object-oriented rendering library (snesgfx) and compiled to a
real .sfc ROM with the
llvm-mos-based 65816 toolchain. Sprites are
hardware OAM objects; the art is gfx4snes
tiles linked straight into ROM. It boots into a self-playing demo — press Enter to take
over.
← → move · Z/X/A fire · Enter play · Shift attract
Click the screen, then play. It self-plays until you press Enter — tab away and it pauses.
Controls
| Keys | Action |
|---|---|
| ← → | Move the cannon |
| Z / X / A | Fire |
| Enter | Start — take over the demo |
| Shift | Select — back to the attract demo |
How it's built
The game is one C program on snesgfx, a header-only OOP-in-C library: a
Display owns the boot sequence and a v-blank-gated DMA upload queue; a
SpriteSet wraps the 544-byte OAM (hardware sprite) table; the fleet, player,
bullets and UFO are plain typed objects drawn into it. No far pointers, so it builds in three
compiler modes — default 8-bit, 16-bit accumulator (+mos-a16) and 16-bit index
(+mos-xy16).
Verify fidelity
The whole game logic is a portable, deterministic simulation shared between the SNES ROM and a
host program. The demo plays a fixed scripted run and folds the evolving game state into a
CRC. Verify fidelity reruns that here in your tab and checks the CRC equals
0x9D57 — the same value asserted on the host and on two emulators (MAME and
bsnes-jg) across all three compiler modes in the build gate. Press it to reproduce the
differential check live.