# Restart rules This repository is a restart. The first `ym2151-python` (Phase 0, 2026-11-11 to 2026-11-13) wrote its specification documents by reading the source of Nuked-OPM (`opm.c`, LGPL-2.1) line by line: about 144 `[N:line]` tags, the model's internal names, its arithmetic restated as pseudocode, a YM2164 document resting on the model alone, and two validation programs that included `opm.c` and called its static functions. Its own wave-1 audit (2026-11-13) found that a core built from those documents would be a transcription of Nuked-OPM. On 2026-11-19, under the wave-2 rewrite rules, the old repository was archived (local copy, `zzz-ym2151-python`, under the family's backup area for Phase 0 restarts; never read again) and this one started again from its first commit, `b1e2dcf` (the MIT licence and the ignore rules), the last point before any document or tool existed. ## What came over Only what the wave-1 audit marked clean, checked again on the way: | Carried | Change on the way | | --- | --- | | `scripts/fetch_references.py` (the pins) | dropped MAME 0.228's GPL `ym2151.cpp/.h`, cisc's fmgen (own licence) and two GPL-2.0+ MAME drivers (`taito/opwolf.cpp`, `taito/rastan.cpp`); each pin's note now says how the source may be used | | `validation/opm_ref.c`, `validation/build_referee.sh` (the closed-box referee) | the build no longer compiles `kc_table.c` / `dt1_table.c` (not carried) | | `scripts/referee_probe.py`, `referee_measure.py`, `replay_tap.py` (drive the referee's pins) | one `[N:]` tag and its explanation replaced by the closed-box statement | | `scripts/mame_tap.sh`, `mame_ym2151_tap.lua`, `mame_census.py` (MAME run headless) | ROM path from `MAME_ROMPATH`, not a machine path | | `docs/users.md`, `docs/mame-oracle.md` (MAME runs, board wiring from BSD-3 drivers) | the two GPL drivers' citations removed; local romset paths replaced by descriptions | | the owner's decisions of 2026-11-12 | carried into the new handoff brief, decision 6 rewritten to "run, never read" | Not carried: every specification document (`registers`, `phase-generator`, `operators`, `envelope`, `lfo-noise`, `timers-and-bus`, `output`, `ym2164`), the old handoff brief's technical body, `start-here`, `validation`, `phase0-status`, the old README, `validation/kc_table.c`, `validation/dt1_table.c`, `scripts/compare_freq_tables.py`, `scripts/compare_dt1_tables.py`, and the old `reference/scratch/` notes. The fetched references (`reference/`, git-ignored) and the closed-box run outputs (`reference/*.txt`) were kept: they are third-party material at pins and our own measurements, not documents of the old repository. ## The rules 1. **No GPL, LGPL, MPL, non-commercial or unlicensed source is read**: for this chip, Nuked-OPM, jt51's HDL, MAME's pre-0.230 `ym2151.cpp` (Burczynski), fmgen, and any GPL MAME driver. Check /data/emu/emulator-lineage/docs/sources.md for anything else. 2. **The archived repository is not read**, in any form: code, documents, commit messages. 3. **Translating a model statement by statement is copying**, in any language. 4. **Permitted sources:** Yamaha's YM2151 catalogue (data sheet, LSI-2121512) and application manual (facts, cite page); **IKAOPM** (ika-musume / Raki, BSD-2-Clause, a die-derived YM2151 in Verilog with a traced schematic: code and tables OK with its notice); **ymfm** (Aaron Giles, BSD-3-Clause) and MAME 0.285's BSD-3 `ymopm.*` and `ymfm_mame.h`; hardware recordings; community documents reporting hardware findings. 5. **A model may be run, never read.** Nuked-OPM is built and driven through its public header `opm.h` only (`opm_ref.c`, now nuked-harness's `opm-events` under `EMU_TOOLS_GPL`), as a detector and as a measuring instrument. Its `.c` is compiled, never opened, searched or quoted, including when a comparison fails. A value got this way is tagged `OBSERVED (Nuked-OPM f209e6e)` and is overruled by any document or hardware number that disagrees. 6. **A difference from the closed box is written down, not fixed**, unless a document, IKAOPM's die reading or a hardware recording independently says the core is wrong. 7. **Every rule names its source** with an evidence tag (MEASURED, DIE, TEST ROM, DOC, OBSERVED, FITTED, HYPOTHESIS). IKAOPM statements are `DIE (IKAOPM 08a5b40, file:line)`. 8. **The middle rule.** A fact is usable when someone established it on real hardware and says so in prose. A comment inside a GPL program saying "verified on the real chip" does not by itself count (owner's ruling, 2026-11-19); jt51's silicon README prose is a cross-check, never a sole source. 9. **Nothing by furrtek**, or by any author who objects to AI use. ## The order of work 1. Rewrite the specification from the permitted sources (this restart's first job). 2. Replace the frequency and detune validation with closed-box measurement through `opm.h` (a sine carrier's frequency per KC/KF/DT1), compared with the manual's and IKAOPM's tables. 3. Build the core to the rungs in `docs/handoff-brief.md`.