# The cores this board reuses, and what each needs | Chip | Family core | State | What the SAM needs | | --- | --- | --- | --- | | Z80B (NMOS, 6 MHz) | `../z80-python` (PUBLIC; local `main` cc2f794; origin/main `b59c80b` carries `z80_python.timing.instruction_timing`) | instruction-level core, oracle-certified; access-timing table merged; `read_m1` hook on `m1-fetch-hook-rebased` (`5434349`), unmerged | N1-N3 below | | SAA1099 | none | new | inside this board (saa1099.md, open decision 3) | | WD1772 (VL-1772-02) | none yet; four other Phase 0 boards proposed a shared `wd177x-python` | - | join the shared core (fdc-wd1772.md, open decision 4) | | ASIC | none | new | inside this board (chip rule: SAM only) | | AY-3-8912 | `../ay8910-python` | built | not on the SAM itself; only for Spectrum-sound add-ons (out of scope) | ## z80-python: the needs z80-python's `step()` runs one instruction through the host's `read_byte`, `write_byte`, `read_port`, `write_port` callables and returns its T-states. The SAM's contention, unlike the Spectrum's, is described as applying to **accesses** only (asic.md, U2), and as a grid: an internal-RAM access over the screen may start only on an 8-T-state boundary, over the border on a 4-T-state boundary, and ASIC port I/O only in the last 4 T-states of an 8-T-state cell. So the board needs, for each access, the T-state inside the instruction at which it starts: **N1. Access offsets.** `instruction_timing(bytes)` on origin/main gives every MREQ/IORQ access's offset (derived from SingleStepTests' per-T-state bus samples; emulator-derived, tier 5 for timing). With it the board computes each wait as the access arrives: the k-th callback is the k-th access, its nominal offset is in the table, every earlier wait pushes it later. Whether the ASIC samples MREQ at the start of T1 or later is the question the grid's phase (U1) hides; the table gives T1, the board adds a constant to be fitted against SO-M1's measured bar positions. **N2. Interrupt acknowledge and HALT timing.** The FRAME and LINE interrupts are ~20 us long (TECH p21); IM 1's acknowledge (13 T on the Z80) has its own accesses (the push of PC into contended RAM). The timing table excludes the acknowledge and HALT, the same request zxspectrum-python made (its N3). Ask once, for both boards. **N3. The M1 hook** (`read_m1`): not needed for contention (M1 is an ordinary memory access to the ASIC as far as the documents say), useful for traces. No request. **Not needed:** a cycle-stepped Z80. If U2 turns out wrong (the ASIC also holds internal cycles), the Spectrum board's N1 extension (internal cycles with their address source) covers it. ## The CPU's other duties on the SAM - 6 MHz Z80B: the same instruction set and undocumented behaviour as the NMOS Z80A; no variant switch is needed (HYPOTHESIS: no SAM-specific CPU quirk is documented). - IM 1 only by convention (all interrupts on /INT, STATUS tells them apart; TECH p21). IM 2 would read the floating data bus during acknowledge; what the SAM's bus holds then is unknown (U15) and only matters for software that uses IM 2. - NMI from the BREAK button (TECH p4).