# The CPU: z80-python, and what this board needs from it The Astrocade's CPU is a Zilog Z80 at 1.7898 MHz (SYS 135). The family already has the core: [z80-python](../../z80-python) (with z80-rust, z80-rust-fast and z80-python-fast downstream). No new CPU core is needed. Pin z80-python's current `main` when building. ## What z80-python gives today (read 2026-11-26 at `1302260`) - Callable bus: `Z80CPU(read_byte, write_byte, read_port=, write_port=)`; ports get the full 16-bit address (`IN A,(n)` puts A on the high byte, `IN r,(C)` puts B), which is what the Astrocade's high-byte decoding of ports 0B and 18 needs ([memory-map.md](memory-map.md)). - `request_maskable_interrupt(vector_byte)`: the vector byte the Address chip supplies from port 0D (IM 2) arrives as an argument; `clear_maskable_interrupt()` cancels an unaccepted request, which is what interrupt mode 1 ("discarded if not acknowledged by the next instruction", SYS 92) needs. - `step()` returns an instruction's T-states. It does **not** say at which T-state each memory access happens (its docs: "T-states are instruction/lifecycle totals, not externally observable bus cycles"). ## What the board needs (requests to raise upstream, with repros, when building) 1. **Per-access timing, to add WAIT states.** SYS 111-112: one WAIT on every memory access, one more when the screen scan collides. The board can count accesses through its own `read_byte`/`write_byte` callbacks (each call is one access, so a fixed one-wait-per-access cost is reachable today), but the *collision* wait depends on the T-state at which the access falls against the scan's RAS slots. That needs the core to tell the host when each access happens within the instruction (or to call a wait hook per machine cycle). The z80-python-m1-hook branch (ColecoVision track, `read_m1(address, kind)`) is the precedent; this is the larger request. Until it lands, M1 can model the fixed wait and log the collision wait as a known gap (decision 3 in the brief). 2. **M1 and refresh visibility** are not needed: the microcycler passes A0-A7 during refresh, but nothing on the board acts on it (SYS 109). 3. **Interrupt acknowledge**: the Address chip places the vector on the bus "of the second wait state of the interrupt acknowledge cycle" (SYS 136); z80-python's instruction-boundary model is enough for that. ## Order of record One domain for the CPU and the video chips (they share the bus and the WAIT line); the I/O chip's sound is a producer fed by port writes stamped with their T-state. See the brief's "Domains and speed".