# Build progress (so another agent can resume from the repository alone) The build follows `docs/handoff-brief.md`, milestones M0-M8 in order, one milestone per commit (more commits inside are fine), under the restart rules (`docs/restart.md`). The open decisions are settled (2026-11-12: every recommendation adopted). A private GitHub remote exists; nothing is pushed by agents. ## How to work here - `.venv` (CPython 3.14) and `.venv-pypy` (PyPy 7.3.x, Python 3.11): `python3 -m venv .venv && .venv/bin/pip install -e ".[dev]"`, the same with `pypy3.11 -m venv .venv-pypy`. **PyPy's venv needs `pip install --upgrade pip` first**: pip 24.0 rejects the `git+file://` pin as an invalid URL. - The CPU core is `w65c02-python` (pin: see `pyproject.toml`), pinned `git+file` in `pyproject.toml`. Repin with `pip install --force-reinstall --no-deps ""` in both venvs and confirm with `pip freeze`. - Lint: `.venv/bin/ruff check .` and `.venv/bin/ruff format --check .` (ruff 0.16.8; its default rules want scripts executable). - Quick loop: `.venv/bin/python -m pytest` (slow tests excluded by default); `-m slow` for the test-ROM and library runs. - Long runs: `PYPY_GC_NURSERY=1M nice -n 19`, at most four processes. ## Milestones | Milestone | State | Judge, tier | Measured | | --- | --- | --- | --- | | M0 formats front door | **passed** | the data sources (tier 5 data; tier 2 size rule) | `scripts/m0_formats.py`: 843 images, 0 errors (838 carts, 3 BLL, 2 boot ROM images refused as carts and recognised by hash); 22/22 `.lnx` = `.lyx` in SHA-1 and description; census 129 / 290 / 2; C14 conflicts reported; round trip 20/20 byte-identical. validation.md "M0" | | M1 CPU on the bus through the boot ROM | **passed** (host decryption 52/128 run) | MAME (tier 5) for flow, spec (tier 2) for the port | 5 titles agree with MAME for whole 4 s traces; D1 explained; 52/128 frames identical; seeded fault caught. validation.md "M1" | | M2 tick costs, timers, interrupts, sleep, math | **51/52 per row** | lynx-tests (tier 3); LA captures (tier 1) for the costs | page-mode 6/6 and timers2 10/10 after the bus costs were measured from the captures (DPRAM slots, refresh, stream reads: validation.md "M2 (bus costs from the captures)"); sdoneack 6 waits for M4/M5's draw time | | M3 display | **passed** (picture judged with M4) | LA captures (tier 1) or LT numbers (tier 3) | line and frame period agree to the tick on 15/15 measurable captures; the four titles' frame periods equal their captures (Lemmings, Krazy Ace at 8 s, Batman Returns at 9 s). validation.md "M3", "M3 title frame periods" | | M4 sprite engine, function | **passed** (CRCs 40/40 per row) | lynx-tests CRCs (tier 3) | `suzy/engine.py`; smoke pictures in validation.md "M4"; faults 5/5 | | M5 Suzy's time | **partial** (15/40 per row, exit not met) | lynx-tests (tier 3); Batman capture (tier 1) | default: the measured timeline (`la_sprite.py`, 2-tick page-mode RAS groups), 15/32 held out vs 13/32 for the max-of-paths model (`LYNX_SUZY_TIMELINE=paths`). validation.md "M5 structure" | | M6 audio and UART | **suites 32/34 per row** | lynx-tests (tier 3) | audio 6/6, audio2 7/7, uart 4/6, uart2 5/5, uart3 6/6; mix + `--wav`; faults 8/8. validation.md "M6 UART, CTLB levels, the mix and WAV" | | M7 carts beyond ROM, sweep | **EEPROM done** | the titles' own save checks | 93C46 family on A7/A1/AUDIN; Nutmeg, Growing Ties, Circuit Dude save and load across runs; faults 2/2. AUDIN banking, bank 1, sweep not started | | M8 frontend | **built, judged headless** | SDL dummy drivers | `lynx-play`: window frames = board frames 600/600, pace = measured period, sound = samples; faults 5/5. No human has looked at it. validation.md "M8" | ## Session of 2026-11-14 (second Specification pass) Scope, one item per commit: (1) saved pictures follow the cart's rotation (**done**: `picture.py`, validation "Saved pictures follow the cart's rotation"); (2) M6 UART, CTLB flags, mixer, WAV (**done**: 96/122 per row, validation "M6 UART, CTLB levels, the mix and WAV"; Holani WAV comparison owed); (3) M7 EEPROM (**done**: validation "M7: the cart EEPROM"; AUDIN banking, bank 1, Alpine Games and the sweep not done); (4) M8 front end (**done**, headless only: validation "M8"; `.venv-pypy/bin/pip install pygame-ce` first); (5) M5 structure (**done, exit not met**: measured timeline default, validation "M5 structure"); (6) smoke titles: 25/29 at a title screen at 1,200 frames with the measured timeline, 29/29 with more frames and presses (validation "Smoke list after the M5 structure change"); Holani/MAME comparison **not run** (owed: build Holani with `cargo build --release` in `reference/src/holani-retro`, run it under `timeout 1800`); (7) close-out done. Next agent, in order: the Holani/MAME smoke comparison; the Holani WAV comparison (M6); M5's overlap of source reads with destination work (needs a capture of a literal sprite); AUDIN banking and bank 1 (M7); the M7 sweep at a commit point; the no-boot-ROM start. (5) M5 measured timeline; (6) remaining smoke titles; (7) close-out. ## In progress - M2 leftover: sdoneack 6 (after M4/M5). Capture tools: `la_trace.py` (cycle list), `la_compare.py` (board vs capture), `la_registers.py` (register access lengths), `la_refresh.py`, `la_dma.py`, `la_phase.py`. - M3 leftovers: P4/H from PBKUP; the Timer 0 borrow to first group (now separable: `la_dma.py` finds the fetches by their 2-tick CAS runs; the first is about 37 ticks after HSYNC at the standard setting, 192 apart). - M5 leftovers: the row model's structure (1 vs 2 bpp full rows, collision types); `scripts/m5_fit.py` refits and reports the held-out suites. - M6 next steps: the linked timers' CTLB flags (audio2 1-3: borrow in/out read as pulses, last-clock level); the UART (`Mikey.uart` hooks exist: `clock`, `irq`, `read_serctl`, `write_serctl`, `read_serdat`, `write_serdat`) from Spec ยง8a and LT timers' UART section; then the mixer, PWM and `--wav`. Then M7 (93C46 EEPROM, saves under `~/.local/share/lynx-python/`), M8 (pygame-ce window in `.venv-pypy`). - The no-boot-ROM start (host decryption to a running cart) is owed. - Front end so far: `python -m lynx_python CART --frames N --png out.png` (needs the boot ROM; host decryption is not wired to start a cart yet); `scripts/smoke.py` saves the smoke list's pictures to `tests/runs/smoke/`. ## Traps found - Romsets by environment variable: `NO_INTRO_DIR`, `MAME_ROMPATH` (the boot ROM in `lynx.zip`). `lynx_python.romsets` is the one place that reads them. - The hardware tests need cc65 newer than release 2.19: the pinned tree `reference/src/cc65` is built with `make` once; `build_lynx_tests.py` uses it. - MAME needs a trace of about 4 s to get past the boot ROM: the ROM's bignum routine (copied to `$5000`) takes 1.4-2.3 M instructions. - A whole-library scan (`m1_frames.py` without `--limit`) is a library-wide sweep: run it only at a commit point. - PyPy's venv: pip 24.0 cannot parse `git+file:///...@commit`; upgrade pip. - The M0 judge spends its time in `7z` subprocesses (two per `.7z`, 317 of them): about 2 minutes wall at load 30-40. - The lynx-tests ROMs are `.lnx` with a 1024-byte block header and a payload of about 6-10 KB (far fewer than 256 pages); the loader takes the header's block size and reports nothing odd.