# Handoff: the sound-core restart (2026-11-13) Written at the end of a long session, for a fresh session on any model. Read it all before touching anything, then tell the user in a few sentences how you read it and what you will do first. **Everything here is local. Push nothing and create no GitHub remote until the user says so.** ## What happened A public-readiness audit on 2026-11-12 found that three sound cores were function-by-function translations of GPL or LGPL C models (the Nuked family), published as MIT with READMEs saying nothing was copied. The user had understood those models to be measurement references only. The cores and their Rust ports were made private, renamed `zzz-`, archived on GitHub, and their local clones moved to `/data/backup/nuked-derived/`. **Do not read anything under that path**, and do not read any Nuked `.c` source anywhere on this machine. The three cores are being rebuilt from documents under written rules. ## The rules They are in `docs/restart.md` of each of the three new repositories (rules 1 to 11), and they are binding. In short: no GPL or LGPL source is read; the archived cores are not read; translating a model statement by statement is copying; a reference model may be **run** through a harness as a closed-box detector, its source never opened, including when a comparison fails; every fact carries its provenance; a second-hand fact is usable when someone confirmed it on real hardware and says so in prose (the "middle rule"), and code fragments stay closed wherever they appear; ROM contents read out of real hardware and published are facts about the chip. The user's standing preferences that matter here: - Chip-level technical questions are not put to him: take the best-supported option and mark it **provisional**. Policy questions are his (licences, an author's wishes, anything outward-facing, anything needing his hardware). - Work by the author "furrtek" is excluded entirely. - ROM locations come from the environment (`NO_INTRO_DIR`, `MAME_ROMPATH`), never a path written into a repository. - No `rm -rf`, no `sed -i`, no forced commands; set things aside in a git-ignored `trash/`. - The home disk is nearly full. The machine is heavily loaded. Not yet ruled on, so the answer is **no** for now: using a closed-box model as a measuring instrument (recovering ROM contents by output search, fitting constants to its output, building a stand-in that imitates it). ## State of each repository | Repository | State | | --- | --- | | `/data/emu/sn76489-python` | **Built.** 233 tests pass. Written from `docs/spec.md`. Matches the one hardware capture (the discrete chip's noise). Nuked-PSG as a closed box: identical on 19 of 51 streams for the Mega Drive variant; the differences are recorded open in `docs/validation.md`. Holds `validation/as_observed.py`, a stand-in built from the model's outputs before the "no" above was written: leave it untouched until the user rules. | | `/data/emu/ym2413-python` | Phase 0 done. A build was started on 2026-11-13 and interrupted: **read `docs/build-status.md` first**, then `docs/handoff-brief.md` (its last section, "Decisions taken", settles the policy questions). The build begins with a provenance audit of `docs/spec.md`, because the research agent read some tainted passages before recognising them. | | `/data/emu/ym2612-python` | The same: Phase 0 done, build started and interrupted, **read `docs/build-status.md` first**. The largest of the three. | | `/data/emu/sms-python` | Private on GitHub. Local branch `new-psg` runs on the new PSG (all tests pass) and is ahead of the remote by several commits. Its FM unit still imports the OLD `ym2413_python` from its virtual environment until the new core exists. Read `docs/handoff-2026-11-12.md`. | | famicom-python, famicom-rust, famicom-rust-fast | Public. The VRC7's sound is switched off on each `main` (one revertable commit each) until the new YM2413 core exists. | | megadrive-python, megadrive-rust, megadrive-rust-fast | Private. They pin the archived cores and will not build until the new cores exist. Not audited for their own use of Nuked-MD. | ## A warning from the first builds When a closed-box comparison disagrees, the pull to make the core match is strong. The YM2612 build agent, despite its brief, tried to change the core's accumulator after the detector showed a difference; a permission guard refused the edit, the core is unchanged, and the difference is recorded as open. The PSG build agent built a script imitating the model's timing from its outputs. Neither opened the model's source, but both drifted toward letting the model decide. Brief every agent that continues with this in plain words: **a difference from the detector is written down, not fixed**, unless a document or a hardware measurement independently says the core is wrong, in which case cite that. Where the YM2612 build stopped (its `docs/build-status.md` has the detail): the audit, the core for both variants, 186 passing tests, the faults script and the Nuked-OPN2 closed-box rung are committed. Not done: README, `claims.md`, `adoption.md`, the validation write-up, and the comparisons with recordings and with ymfm. Where the YM2413 build stopped (its `docs/build-status.md` has the detail): the provenance audit is complete for every spec statement (three struck to emulator-tier defaults, seven restated) and the core is committed. The contract tests (24) and the manual-derived tests (229) pass. The measurement tests are work in progress: 159 pass and 32 fail, the failures not yet examined, and some are faults in the tests. Lint was never run. Not started: the closed-box rung (no detector has been run and nothing was tuned), the other comparison rungs, the faults script, README, `claims.md`, the validation write-up. ## What comes next, in order 1. Finish the YM2413 build from its `docs/build-status.md`. Use a fresh agent with the brief's limits; it must not re-read the tainted passages. 2. Finish the YM2612 build the same way. 3. Adopt the new YM2413 in sms-python (branch `new-psg`) and remove the old package from its environment; restore the VRC7's sound in the three famicom repositories by reverting the "Switch the VRC7's sound off" commits and pointing them at the new core. 4. Adopt the new PSG and YM2612 in megadrive-python; its validation documents claim sample-for-sample equality with die models in many places and must be rewritten to what the new cores measure. 5. Rust ports of the three new cores, transcribed from the new Python. 6. Only then, and only on the user's word: remotes, pushes, and the question of making sms-python public. ## Waiting on the user - May a closed-box model ever be used as a measuring instrument (three cases: the YM2413's built-in voices, the YM2612's ladder constants, the PSG stand-in script)? - A decapping site's page may hold a real dump of the YM2413's instrument ROM; it refuses automated fetches and needs a person with a browser. - His Genesis has a broken controller port. Once repaired, test-register probes on it would settle most of the YM2612's and the Mega Drive PSG's unknowns. - The play sites (play-md, play-nes) still serve builds made from the old Rust cores. He said to leave them up for now. - z80-python's own audit findings (his name in old commits and in the PyPI source package, GPL test data in history, document errors) are untouched. ## Progress, second session (2026-11-13) - **Step 1 done.** ym2413-python `62e8459`: rung 2a triaged (31 test faults, one core change from spec 7.10), rung 3, the provisional record, Nuked-OPLL closed box (O1-O7 open; main one: the model drops S4's measured modulator lag), faults 30/30, README, claims, api. 514 tests + 1 strict xfail. - **Step 2 done.** ym2612-python `aea9bd8`: figures re-confirmed, validation write-up (nine open differences, spec U27-U29), README, claims, api, adoption. For the user to rule on: closed-box table 2 and probe 2 (harness-side changes to the core's input; probe 2 picks between C14's sides). - **Step 3 done for the Python boards.** - sms-python `new-psg` `b290e09`: the FM unit runs the new core (`take_outputs`; state VALUES emptied; test rewritten); Phantasy Star (J) plays FM. Installed editable from ../ym2413-python in both venvs. - famicom-python `main` `19a4f49` (ahead 13, nothing pushed): merged origin/main (bringing 4ef9d3d), then reverted it with the new core. Board fix: one summed pair per sample (the old code summed 18 entries). db_vrc7 +11.27 dB; Lagrange Point plays FM at 37.4 frames/s. - famicom-rust and famicom-rust-fast: VRC7 stays off until step 5 gives a Rust YM2413. - Next: step 4 (megadrive-python adopts the new PSG and YM2612; its validation documents to be rewritten), then step 5. - **Step 4 done for megadrive-python** (`pin-2-od2` fast-forwarded to origin, then `2c17435`, ahead 1, nothing pushed): both restarted cores adopted (glue in board.py, system.py, audio.py; FM frames x3 to keep PSG_GAIN's units); test_milestone4.py rewritten; 223 tests pass; Sonic sounds; MDFourier PSG/FM -6.42 dB vs console -6.70. Every die-model equality claim in the docs marked as the withdrawn cores'. Left for the board's own Nuked-MD audit: M68K_FM_WRITE/READ_MCLK, the scripts that drive the withdrawn cores, doc passages citing the models' source lines. megadrive-rust and -fast wait for step 5. ## The owner's ruling on P6 (2026-11-13), and what it opens The user ruled that a closed box **may be used as a measuring instrument**. Source stays closed; values got this way are marked "closed-box measurement" (emulator tier, model and commit named), and documents or hardware overrule them. Recorded in each restarted repo's `docs/restart.md` (amendment) and in memory. Opened by it, **not started** (the Python cores are frozen at the commits the Rust ports are pinned to, f88dccf / a6e8e5d / f8157f4, until step 5 lands): - sn76489-python: `validation/as_observed.py` (the stand-in) may now stay; its timing differences may become provisional values marked as closed-box measurements. - ym2612-python: closed-box table 2 and probe 2 (the LFO divider choice, C14) are now legitimate; the ladder constants could be fitted to Nuked-OPN2's discrete mode (U12), though a hardware recording (Aly James's MD1_LADDER.wav) outranks it. - ym2413-python: the YM2413's 15 built-in voices (U1, today emulator-tier data) could be recovered by searching for user tones that reproduce Nuked-OPLL's output. - The boards: megadrive-python's M68K_FM_WRITE/READ_MCLK (fitted on Nuked-MD) are of this kind and no longer a rules problem; their provenance should still be cited. Step 5 (running 2026-11-13): three agents porting the cores to sn76489-rust, ym2413-rust, ym2612-rust under /data/emu (local, no remotes). ## Step 5 done (2026-11-13): the Rust ports All local, no remotes, each proven equivalent to its Python pin on four rungs (transcribed tests; seeded lockstep byte for byte; the core's validation streams; the Python faults script's faults, all caught): - sn76489-rust `ee1b661` (pin f8157f4): 22/22 faults; ~1,400-1,650x real time. - ym2413-rust `94df223` (pin f88dccf): 30/30 faults; ~80-120x real time. - ym2612-rust `ead7f88` (pin a6e8e5d): 28/28 faults; ~80-150x real time. Fault scripts stamp copies' mtimes before building (shared cargo targets otherwise judge a fault on another copy's binary). **gb-apu-rust's `scripts/seeded_faults.py` has the unstamped pattern: its 30/30 should be re-run.** Reference test faults found by the ports (core behaviour unaffected): ym2413-python `test_manual.py::test_table_iii_6_modulation_index` second half checks nothing (`first` is always 0, so it reads b[-1], b[-2]); ym2612-python's `channel_values()[5]` reads the DAC registers at call time, not at the last sample. Next: the Rust boards (famicom-rust/-fast VRC7 back on; megadrive-rust/-fast adopt the three Rust cores), then -fast forks of the cores, then the P6 openings above, then remotes and publication on the user's word. ## Slice deployed (2026-11-13): play-md on the restarted cores At the user's request, play-md.supertux.com now runs megadrive-rust-fast `4659d3b` (local branch `new-sound`: ym2612-rust and sn76489-rust by path, glue as megadrive-python's) via play-md `3494ec1` (local commit). Gate: the board's trace equals megadrive-python 5d1f0bb plus the sound glue, line for line, on the five example cartridges; 22 tests pass; live SoR2 59.78 fps with sound. Rollback in play-md memory. - 2026-11-13: the user listened on the live site: "several games and even the overdrive demos ... sound fine". The restarted YM2612 and PSG pass the ear test in the browser. ## Task list (user approved 2026-11-13: "add all of these to your task list and work through them") 1. [x] (2026-11-13: megadrive-rust-fast 4659d3b + megadrive-rust a3f3abb on pin-2-od2, lockstep 80/80) Make the slice permanent: megadrive-rust-fast `new-sound` into `pin-2-od2`; megadrive-rust (the transcription) onto the same cores, lockstep kept. 2. [x] (2026-11-13: famicom-rust 6b8536c, famicom-rust-fast 83b95b7; 5/5 VRC7 cases vs fe89099+glue on the new core, audio included) famicom-rust and famicom-rust-fast: VRC7 sound back on, with ym2413-rust. 3. [~] (2026-11-13: six PRIVATE repos created and pushed over SSH, CI green on all six; megadrive-python 41f92f2+test fix, megadrive-rust af34ef5, megadrive-rust-fast 0f9b724 rebased onto the remotes' newer work and pushed (lockstep 80/80); sms-python new-psg and play-md pushed. HELD: famicom-python/rust/rust-fast mains (PUBLIC; would depend on private cores; user to choose: cores public after audit / push anyway / hold). play-md live still runs board 4659d3b, not the rebased 0f9b724) Remotes and pushes: private remotes for the 3 Python cores and 3 Rust crates; push the board branches. Public only after audit + docs-freshness (family rule). 4. [ ] Measuring-instrument work (P6 ruling): YM2413 voices from Nuked-OPLL; YM2612 LFO divider / accumulator from Nuked-OPN2. Low priority (sound-good-enough). 5. [ ] -fast forks of the new Rust cores, only if a board needs the speed. ## 2026-11-14: published, and the GPL findings that remain - ym2413-python and ym2413-rust audited (single author, history starts at the restart, no secrets/large files/machine paths, no Nuked source tracked) and flipped PUBLIC. - famicom-rust ce76eed and famicom-rust-fast ff09aec PUSHED to main: VRC7 sound on ym2413-rust pinned by git (94df223). - famicom-python NOT pushed (local main ahead): it also depends on ay8910-python, which is PRIVATE and, per another session's provenance audit (ay8910-python 20b0fe9, local), has "facts read from the GPL die model's source; four items to re-derive". The user, 2026-11-14: "We have issues with GPL and LGPL. If we need to we need to throw away our sources and start over." So ay8910-python needs a clean-room restart like the three here (docs/restart.md rules) before famicom-python can go out. - famicom-python's own audit (docs/provenance.md, local 3aaf579) also lists: facts read from Mesen2's GPL source in four mapper files, PROTECTION_208 (from FCEUX via the wiki, leaning rewrite), MMC3's A12 filter from furrtek (excluded author: re-source). famicom-rust/-fast inherit these. Another session appears to own that audit. ## Pre-publication cleanup (2026-11-14), all six core repositories Done and committed locally, not pushed (each repository is 2-4 commits ahead of its private GitHub remote). Per repository: stale status lines fixed; the working papers (handoff briefs, build status, provenance audits, adoption note) folded into one `docs/provenance.md` in each Python core and removed; machine paths replaced by environment variables with relative defaults (`SMS_PYTHON_DIR`, `FAMICOM_PYTHON_DIR`, `MEGADRIVE_PYTHON_DIR`, `YM2413_PYTHON`); references to the owner and to his own console removed; the closed-box ruling merged into rule 8; a calm "History" paragraph in each README and at the top of each `restart.md`; admitted slips rewritten as a neutral "Material seen and not used" section; the Sega manuals described plainly ("a Sega developer binder that circulates online"; "confidential" kept as a fact). Test counts unchanged: 233, 514 + 1 xfail, 186 (Python); 71, 131, 136 (Rust). Still to do before any flip: push these commits, pin sms-python to the cores by revision, and the same audit and cleanup for sms-python and the Mega Drive boards. - 2026-11-14 later: ay8910-python re-derived (wave 2 item 3; engine unchanged, 0 diffs), history reset by the user to one commit e244a09 and flipped PUBLIC (old history in the local `old-history` branch). famicom-python: Mesen2 facts re-established (dc1e4b5, fc44fc8), pushed by the user at d2578a4 (CI failed: ym2413-python unpinned and the AY pin pointed at a reset commit); fixed locally in b0f6a97 + b497cb7 (both cores pinned by git, dry-run resolve clean, 343 tests). Owed: the user pushes famicom-python main. - 2026-11-19: decision 7 (yes, rewrite): famicom-python 9827f83 re-sources the MMC3 A12 filter to blargg's judges (1-2 falls fail, 3-16 pass; 3 kept) and drops the furrtek pin. famicom-python main is 3 ahead (b0f6a97, b497cb7, 9827f83): the user pushes it. emulator-lineage 906f2dd pushed (private). sms-python is being prepared for publication by another session (main ahead 7, 2026-11-19): not touched here.