# z80-survey A **comparison set**, not an oracle. An oracle tells you whether you are correct. This tells you what "correct" costs other people — which is what you actually need when deciding whether a gap is worth closing. Nothing here certifies `z80-python`; it calibrates claims about it. Built 2026-09-10. Local only; not pushed anywhere. ## What it holds - `harness/` — runners that drive *someone else's* core through an oracle. Each oracle has one runner with a pluggable per-core adapter, so every core is measured by identical code. - `results/` — raw stdout from every run, kept verbatim. - `fetch.sh` — reconstructs everything ignored below, at pinned revisions. Nothing third-party is vendored. `./fetch.sh` rebuilds it. ## Why nothing is vendored Not only size (~590 MB). The ten cores span **AGPL-3.0** (PyMSX, pymsx), **GPL** (py-speccy, py_z80, Z80-Emulator), **Apache-2.0** (pyz80), **BSD-3** (z80py), and **three with no license file at all** (Timex.Emu, multirexz80, szilvasyz/z80), which makes those all-rights-reserved by default. Redistributing that set inside one repository is not something to do casually. ## Pinned oracles | Oracle | Pin | Tier | |---|---|---| | SingleStepTests/z80 | `ebe1875d48f374bcfd4b505d8eb8ee751568b5f7` | hardware-corrected, per-instruction | | raxoft/z80test 1.2a | sha256 `7df0443d…cacbaf` | hardware-captured from a real 48K Spectrum | | FUSE 1.6.0 core tests | sha256 `3a8fedf2…047096` | emulator-derived — detector only, never judge | ZEXDOC/ZEXALL `.com` images are not fetched here; the survey used the copies that ship inside PyMSX's own repo. ## Harnesses | File | Oracle | Cores adapted | |---|---|---| | `sst_bus.py` | SST `cycles` pin traces — **bus transactions** | z80-python | | `sst_speccy.py` / `sst_pymsx.py` | SST state + T-states | py-speccy, PyMSX | | `fuse_run.py` | FUSE `tests.in` / `tests.expected` | py-speccy, PyMSX, z80-python | | `z80test_run.py` | z80test `.tap` payloads via an RST 0x10 stub | py-speccy, PyMSX, z80-python | | `speccy_zex.py` | ZEXDOC / ZEXALL under a CP/M BDOS stub | py-speccy | | `pymsx_zex_quiet.py` | ZEXALL via PyMSX's own `zex.py`, with its per-instruction DEBUG logging turned off (it is unrunnable otherwise) | PyMSX | `sst_bus.py` is the one worth porting upstream. It compares the `(type, address, value)` sequence of bus transactions against each SST case's per-T-state `cycles` array — the field `z80-python`'s own `vector_utils.py` currently reduces to `len(cycles)`. Run under PyPy; CPython works but ZEXALL takes ~90 minutes instead of ~6. ## Headline findings Four pure-Python cores pass ZEXALL 67/67. Under stricter oracles they separate: - **py-speccy** — 4 defects: undocumented `SRO (XY),R`, `LD (BC),A` MEMPTR, `INIR→NOP'`/`INDR→NOP'`, and `LD (nn),rr` T-states. - **PyMSX** — 42 failing opcodes, never increments `R`, and hard-crashes on `ED 09` (an undefined opcode real hardware runs as a 2-byte NOP), so it cannot complete any z80test suite. - **z80-python** — clean on all four z80test suites; one bus-ordering defect in `EX (SP),rr`, found here and fixed in alewman/z80-python#8. ZEXALL's structural blind spots are **I/O ports, HALT, the R register, undefined opcodes, and cycle counts**. Both cores driven through every oracle failed inside that list and essentially nowhere else — two unrelated authors, the same gaps, shaped by the same benchmark. ## Instrument warning Three harness bugs surfaced during this survey, each of which first looked like a core defect: 1. `execute_one_cycle()` consumes one byte, so a single call left `_prefixOpcode` stale and poisoned every later case — reported a false 7.33%. 2. Port `0xFE` returned `0xFF`; a Spectrum ULA idles at `0xBF` — produced 9 false z80test failures. 3. `read_port` returned a constant where SST records per-case values — produced 15 false failing opcodes. The instrument was wrong more often than anything under test. Treat a novel failure here as a harness bug until a second oracle agrees.