# Z80 Memory Map Single Z80 CPU at **3.072 MHz** (18.432 MHz crystal ÷ 6). One CPU drives everything — main logic, video, input polling, and triggering the discrete sound board. All addresses below are as seen by the Z80; several ranges are mirrored (hardware decoded a smaller number of address lines than the full 16-bit bus, so the same registers repeat at multiple addresses — this is normal for late-70s designs and *must* be replicated, since original code sometimes uses a mirrored address). ## Full map | Range | Mirror | Access | Meaning | |---|---|---|---| | `0x0000`-`0x3fff` | — | R | Program ROM (only `0x0000`-`0x27ff` populated; see [rom-manifest.md](rom-manifest.md)) | | `0x4000`-`0x43ff` | mirrors to `0x4400`-`0x47ff` | R/W | General work RAM (1KB) | | `0x5000`-`0x53ff` | mirrors to `0x5400`-`0x57ff` | R/W | Video/tile RAM — 1024 bytes, one tile index per byte (32×32 grid; see [video-hardware.md](video-hardware.md)) | | `0x5800`-`0x583f` | — | R/W | Column attribute RAM — 32 columns × 2 bytes (scroll + color); part of the same physical RAM as sprites | | `0x5840`-`0x585f` | — | R/W | Sprite RAM — 8 sprites × 4 bytes | | `0x5860`-`0x587f` | — | R/W | Bullet RAM — 8 entries × 4 bytes (7 player "shells" + 1 enemy "missile"; only 2 of the 4 bytes per entry are used) | | `0x5800`-`0x58ff` | mirrors to `0x5900`-`0x5fff` | — | The three RAM blocks above are all mirrored together as one 0x100-byte block | | `0x6000` | mirrors every `0x0800` up to `0x67ff` | R | Input port **IN0** — coin 1, coin 2, joystick left/right, fire button, cabinet DIP, service switch | | `0x6000`-`0x6001` | mirrored (step `0x0800`) | W | Player 1 / Player 2 start lamps | | `0x6002` | mirrored | W | Coin lockout solenoid | | `0x6003` | mirrored | W | Coin counter | | `0x6004`-`0x6007` | mirrored | W | Discrete sound: select background-drone resistor (see [sound-hardware.md](sound-hardware.md)) | | `0x6800` | mirrored every `0x0800` | R | Input port **IN1** — start 1, start 2, coin/bonus DIP switches | | `0x6800`-`0x6807` | mirrored | W | Discrete sound: tone-generator enables, HIT/FIRE triggers, volume (see [sound-hardware.md](sound-hardware.md)) | | `0x7000` | mirrored every `0x0800` | R | Input port **IN2** — bonus-life / lives DIP switches | | `0x7001` | mirrored | W | Vblank NMI-enable latch (main CPU non-maskable interrupt) | | `0x7004` | mirrored | W | Starfield enable (1 = stars drawn, 0 = off) | | `0x7006` | mirrored | W | Flip screen X (cocktail/cabinet support) | | `0x7007` | mirrored | W | Flip screen Y | | `0x7800` | mirrored | W | Discrete sound: pitch latch | | `0x7800` | mirrored | R | Watchdog reset — must be read periodically or the original hardware self-resets; **an emulator can safely ignore this entirely** (no watchdog = no correctness impact, only real hardware needed it to recover from crashes) | ## Input port bit layout (typical Galaxian convention — verify against actual code if a control feels wrong; standard bit assignment is) - **IN0**: bit0 coin1, bit1 coin2, bit2 joystick left, bit3 joystick right, bit4 fire button, bit5 cabinet DIP (upright/cocktail), bit6 service switch, bit7 service coin. - **IN1**: bit0 start1, bit1 start2, bit2/3 player-2 joystick (cocktail only), bit4 player-2 fire (cocktail only), bits 6-7 coinage DIP. - **IN2**: bits 0-1 bonus-life DIP, bit2 lives DIP, remaining bits unused/DIP. ## Interrupts A non-maskable interrupt is generated once per video frame at vblank when the `0x7001` enable latch is set. The Z80 enters its NMI handler at `0x0066`; maskable interrupt flip-flops do not gate this signal. Despite the traditional driver naming, the latch does not select a Z80 maskable IRQ on this parent board.