# Galaxian Hardware Documentation Technical reference for building `galemu` — a Python/pygame Galaxian emulator/recreation. This directory exists specifically so an autonomous coding agent (afk-developer) has source-backed hardware facts to build from, instead of guessing from general training knowledge. An LLM coder cannot reliably invent a correct Z80 memory map, palette decode, or starfield algorithm from scratch; those facts are captured here. Galemu consumes the released `z80-python` package; CPU semantics and lifecycle development belong in that upstream package rather than in this board repository. ## ROM identification (confirmed) The verified reference set is a **byte-for-byte, CRC32-verified match** for MAME's `galaxian` parent set: > `GAME( 1979, galaxian, 0, galaxian, galaxian, galaxian_state, init_galaxian, ROT90, > "Namco", "Galaxian (Namco set 1)", MACHINE_SUPPORTS_SAVE )` This is the original 1979 Namco board — not Midway's later license variant (which uses a different, larger ROM split), not a bootleg, not Moon Cresta/Scramble-derived hardware. Every fact in these docs is specific to *this* board. See [rom-manifest.md](rom-manifest.md) for the full file-by-file verification. ROM binaries are deliberately excluded from this repository. Supply a legally obtained, verified MAME archive at `rom/galaxian.zip` to run the emulator directly, or place an extracted set at `rom/galaxian/`. ROM-marked evidence tests use the extracted set and skip automatically when it is absent. ## Interactive play and recording Launch the portrait pygame display with: ```text python -m galemu --rom-path rom/galaxian.zip --display --scale 3 ``` Add `--record OUTPUT.mp4` to capture a shareable H.264/AAC session: ```text python -m galemu --rom-path rom/galaxian.zip --display --scale 3 --record demo.mp4 ``` From Windows Explorer, double-click `run-galemu.bat` to launch the emulator, or double-click `record-demo.bat` to launch it and save the recording as `demo.mp4` beside the batch file. The launchers prefer `rom/galaxian.zip`, fall back to `rom/galaxian/`, and create a project `.venv` with pinned dependencies on first launch. Recording requires `ffmpeg` on `PATH`. Close the window or press Escape to finalize the MP4. The recorder writes every emulated $60.606$ Hz frame and the corresponding pure 48 kHz synthesized PCM, so temporary display-frame drops do not appear in the saved video. Output is the cabinet's 224×256 portrait image scaled with nearest-neighbor to 672×768. ROM files and emulator traces are never embedded in the recording. ## Documents in this directory | File | Contents | |---|---| | [rom-manifest.md](rom-manifest.md) | Every ROM file: size, CRC32/SHA1, which memory region/offset it loads at | | [memory-map.md](memory-map.md) | Full Z80 address map: RAM, video RAM, sprite RAM, I/O ports, sound registers | | [video-hardware.md](video-hardware.md) | Resolution/timing, tilemap layout, sprite layout, palette decode, starfield algorithm, bullet rendering | | [gfx-bitplane-spec.md](gfx-bitplane-spec.md) | Exact two-plane byte/bit layout for 8×8 tiles and 16×16 sprites | | [sound-hardware.md](sound-hardware.md) | The discrete (non-chip) sound circuit, its register map, and a practical pygame equivalent | | [gameplay-reference.md](gameplay-reference.md) | Enemy formation, scoring, controls, attract-mode text | | [build-approach.md](build-approach.md) | **Read this before writing any code.** True Z80 emulation vs. native recreation, staged build plan, risk notes | | [machine-layer-plan.md](machine-layer-plan.md) | Executable consumer-cutover, headless-board, observability, determinism, and work-allocation plan | ## Sourcing and confidence Facts here come primarily from MAME's own source (`mamedev/mame`, `src/mame/galaxian/galaxian.cpp` and `galaxian_v.cpp`), which documents this exact board from real schematics — re-derived and paraphrased in original wording here, not copied verbatim (MAME's source is GPL-licensed; these docs restate the underlying factual/interface information rather than reproduce its text). A few gameplay-only facts (exact scoring values) are marked as community-consensus rather than source-verified — call those out explicitly if you need them to be exact. ## A note on scope This is real, non-trivial arcade hardware: a Z80 CPU executing 14 years of tightly timed 8-bit code, a hand-built discrete sound board with four 555 timers, a bit-exact resistor-weighted color PROM, and an LFSR-driven starfield. Building a genuinely accurate emulator is a substantially bigger undertaking than a simple pygame game — see [build-approach.md](build-approach.md) for a realistic, staged plan.