# Provenance Audit of 2026-11-13 (provenance audit, wave 1), against the family charter's "Licences and provenance" rules: nothing copied or transcribed from GPL/LGPL code; facts (register maps, timings, measured results) are usable, a second-hand fact when someone established it on hardware and says so in prose; GPL/LGPL programs may be run as closed boxes. The auditor did not open any GPL/LGPL source. It read this repository's code, docs, pin lists, scripts and history, and ran `pcengine-python/scripts/provenance_check.py --repo spc700-python --reference reference/src/ --licences scripts/pinned_repos.json` against each pinned tree (ares, jsmoo, SingleStepTests, bsnes, Mesen2, game-music-emu, MAME; the GPL ones because reading them is this repository's documented Phase 0 practice, README "sources"). Findings below. ## Verdicts | Part | Where its behaviour came from | Source licence | Verdict | | --- | --- | --- | --- | | `src/spc700_python/_opcodes.py` (generated table: mnemonic, operands, bytes, cycles, flags) | anomie's SPC700 Doc r1162, via `scripts/anomie_opcodes.py` and `scripts/gen_opcode_table.py` | document, no licence stated | **clean** (facts; already cited in the file header). provenance_check's prose hits against Mesen2 `SpcDisUtils.cpp` and MAME `spc700.cpp` are the opcode map itself (mnemonic order), which every SPC700 table shares | | `_alu.py`, `_bit.py`, `_control.py`, `_moves.py`, `_word.py`, `_core.py`, `_dispatch.py`, `_flags.py`, `cpu.py`, `state.py` (the core) | per-opcode cycle schedule from docs/timing.md (anomie's cycle doc + SingleStepTests spc700); results and flags from anomie and fullsnes; DIV from anomie's loop; power-on registers from ares (a fact, U12). Verified bus-exact on all 256,000 SingleStepTests cases | anomie: none stated; SST and its generator JSMoo: MIT; ares: ISC | **clean**, with one note: comments in `_control.py` (module docstring, line 134) and docs cite what Mesen2's source does (C6, C7). Those are comparisons, not the basis (the corpus decides), but they show Mesen2 (GPL-3.0) was opened during Phase 0. Suggested wording change: rest each claim on SST/anomie and drop the Mesen2 source remarks, or restate them as closed-box results | | `harness.py`, `replay.py`, `trace.py`, `debug.py`, `console.py`, `disasm.py`, `__main__.py` | own tooling; S-SMP register map from anomie/fullsnes; `.spc` layout ("SPC File Format v0.30", named as in libgme `Snes_Spc.h` `spc_file_t`); MAME log format | facts; file format is a community spec | **clean**. provenance_check's table hit against bsnes `io.cpp` is the `$F0-$FF` register switch (the register map). The `.spc` layout citation should name the format document rather than the LGPL header (cite) | | `tests/` | own tests; data read at run time from `reference/` (not committed) | SST MIT; gilyon snes-tests MIT; PeterLemon none stated | **clean** | | `scripts/anomie_opcodes.py`, `gen_opcode_table.py`, `sst_survey.py`, `mame_trace.py`, `fetch_references.py` | own scripts | - | **clean** | | `scripts/build_referees.py` | cuts gilyon's programs from the MIT release; writes the 64-byte IPL ROM from anomie's doc after checking MAME's CRC | IPL ROM is Sony/Nintendo firmware | **clean**: the IPL ROM lands in ignored `reference/build/`, never committed; the harness loads it only when present (charter rule 9) | | `docs/undocumented-behavior.md`, `docs/timing.md`, `docs/start-here.md`, `docs/validation.md`, `docs/README.md` | anomie, fullsnes, SST, ares, plus observations read from bsnes, Mesen2 and MAME source | ares ISC; bsnes GPL-3.0; Mesen2 GPL-3.0; MAME `cpu/spc700` BSD-3-Clause, `machine/s_smp` LGPL-2.1+ | **rewrite (docs, small)**: see below | | `docs/handoff-brief.md` rung 5 ("a small Mesen2 or ares harness that dumps per-cycle bus activity") | plan | Mesen2 GPL-3.0 | **rewrite (one line)**: build rung 5 on ares (ISC) only, or run Mesen2 strictly as a closed box; hooking Mesen2 means opening its source | Counts: clean 6, cite 1 (`.spc` layout citation; quotes from ares need the ISC notice beside them), rewrite 2 (doc passages, no code), unclear 0. ### The doc passages to re-source Facts about the hardware are fine; what Mesen2/bsnes/MAME-LGPL *source* does is not ours to record, and code fragments stay out: - `undocumented-behavior.md` C1 ("Mesen2 passes `-1`"), C4 (Mesen2 `Addr_DirIndIdxY`), C5 (what Mesen2 and MAME do on STOP), C6 ("an internal cycle in Mesen2"), U5 ("Mesen2 implements the loop verbatim"), U12 (Mesen2 and MAME power-on values), B2 (bsnes and Mesen2 timer-2 edge; the quoted `if(!timer2.enable.raise(...))` is also in ares, so cite ares and keep the ISC notice, drop "both trees"), B1 (bsnes' split read); timing.md row BRK ("Mesen2 has `I`") and the bsnes wait-state remarks; validation.md's Mesen2 row. Replace with ares (ISC, notice kept), SST, anomie, or a closed-box run. - Quotes from ares (`if(r.p.p) break;`, `r.ya`, `P = pull()`, the DIV closed form, "result is set based on y (high-byte) only") are ISC: fine, add one line naming ares and its ISC notice in docs/README.md. The core needs no change on account of these: its schedule is the SST corpus's (MIT), checked on every case. ## Git history Seven commits, no deleted files. Removed lines mention bsnes/ares/Mesen2 only as sources in the brief's earlier wording (409a4b8). Nothing from elsewhere was committed and later removed. ## Other - No source file carries an SPDX header yet (family-wide pass owed). - Citation fix made in this audit: `scripts/pinned_repos.json` MAME licence was "BSD-3-Clause / GPL-2.0+"; the files' own headers say `cpu/spc700` BSD-3-Clause, `machine/s_smp` and `sound/s_dsp` LGPL-2.1+. ## Wave 2 (2026-11-19) In place, docs only: the core's code rested on anomie, fullsnes, SingleStepTests and ares already; what changed is wording that described GPL/LGPL sources, four code comments, the pin list and the notices. Rules: emulator-lineage's docs/sources.md (bsnes, Mesen2, libgme, MAME `machine/s_smp` and `sound/s_dsp`: closed box only; ares ISC: code OK with notice; SingleStepTests MIT; MAME `cpu/spc700` BSD-3; anomie, fullsnes: facts). No GPL/LGPL file was opened in this pass; claims were re-checked in ares only. | Item | Was | Now | New source | Verdict | | --- | --- | --- | --- | --- | | undocumented-behavior.md C1 | "Mesen2 passes `-1`" | dropped | SST (`wait`, address null), anomie `??`, ares `idle()` | rewritten | | C2 | ares, Mesen2 and SST | ares and SST | SST (64,000 `D` cycles), ares | rewritten | | C3 | bsnes, ares and Mesen2 | ares | ares `sfc/smp/timing.cpp`; fullsnes table | rewritten | | C4 | anomie and Mesen2 `Addr_DirIndIdxY` | anomie only | anomie group 7; SST, ares | rewritten | | C5 | Mesen2 and MAME stop issuing cycles | dropped | SST generator, ares `instructionStop` l.558-563 | rewritten | | C6 | ares, Mesen2, SST agree; BRK an internal cycle in Mesen2 | ares and SST agree; BRK's dummy read in both (anomie IO) | ares `instructionBreak` l.148-159, SST `0f.json` | rewritten | | C10 | MAME `OP_ADCM` macro | kept, marked BSD-3 (R. Belmont, Karl Stenerud) | MAME `cpu/spc700` (BSD-3) | cite | | U5 | "Mesen2 implements the loop verbatim" | dropped | anomie loop, ares closed form, SST, gilyon | rewritten | | U7 | ares, Mesen2, SST | ares, SST | ares l.148-159, SST | rewritten | | U9 | bsnes, ares, Mesen2 (`CheckFlag`) | ares | ares `sfc/smp/io.cpp` l.82 (ISC) | rewritten | | U12 | Mesen2 and MAME power-on values | ares only; others "read under the old rule; closed box from now on; never a default" | ares `spc700.cpp` l.32-40 | rewritten | | B1 | bsnes/ares split read | ares | ares `sfc/smp/memory.cpp` l.15-22 | rewritten | | B2 | bsnes and Mesen2 timer-2 edge, `if(!timer2.enable.raise(...))` "both trees" | ares (ISC, quoted with the notice) against anomie | ares `sfc/smp/io.cpp` l.108 | rewritten | | timing.md BRK row, wait-state remarks, sources paragraph | Mesen2 `I`, bsnes/ares | ares; anomie IO | ares, fullsnes, blargg's notes as prose | rewritten | | validation.md emulator table (bsnes, Mesen2, libgme rows), rung 5, rung 6, tiers | read as detectors | ares and MAME `cpu/spc700` read; bsnes, Mesen2, libgme closed boxes; rung 5 "ares only, or Mesen2 strictly as a closed box (trace logger, no hook needing its source)" | sources.md | rewritten | | `_control.py` docstring, l.134; `_moves.py` l.239; `_core.py` `_indirect_y_load` | Mesen2 remarks | SST and ares | SST, ares | rewritten (comments only) | | `.spc` layout (`harness.py`, validation.md, handoff-brief.md) | libgme `Snes_Spc.h` `spc_file_t` | the SPC file format document, "SNES-SPC700 Sound File Data v0.30" | community file-format spec | cite | | handoff-brief.md rung 5, start-here.md, README, docs/README.md, mame-oracle.md | Mesen2/bsnes/libgme as read sources; MAME S-SMP statement from the LGPL device | closed box only; the TEST-register remark marked old-rule | sources.md | rewritten | | `scripts/pinned_repos.json` | bsnes, Mesen2, libgme fetched; MAME sparse incl. `s_smp`, `s_dsp` | `"fetch": false` for the three; MAME sparse `cpu/spc700` only; `fetch_references.py` skips closed boxes | | rewritten | | `reference/src/bsnes`, `Mesen2`, `game-music-emu` (ignored checkouts) | present | moved, unopened, to the ignored `trash/reference-closed-box/`; MAME's LGPL files dropped from its sparse checkout | | done | | machine paths | `/usr/games/mame`, `/data/emu/roms-retrobat/snes`, sibling repos by absolute path | `MAME`/`mame` on the path, `NO_INTRO_DIR`, repository names | house rule | fixed | | NOTICE, SPDX | none | NOTICE (ares ISC text; MAME BSD-3 holders; SST, JSMoo, gilyon MIT credits); SPDX MIT on every src/test/script file; docs/README.md names ares' notice beside its quotations | | done | **Gates** (PyPy 7.3, `PYPY_GC_NURSERY=1M`): before 1,774 passed; after 1,774 passed (the SingleStepTests corpus, 256,000 cases, gilyon 1,368, PeterLemon 162, MAME replays). No code behaviour changed. Nothing unclear remains for this repository. Downstream: snes-python pins this core; nothing to follow (comments and docs only). ## Closed-box pins removed (2026-11-24) Aubrey's rule of 2026-11-24: an MIT repository does not download or keep the source of anything the family's `sources.md` marks closed box only. Three entries that were already never fetched (`"fetch": false`) but listed source paths left `scripts/pinned_repos.json`; they are cited by URL and commit only: bsnes (https://github.com/bsnes-emu/bsnes @ `78474e5d39f58872dc21aca18cf9eb583b147fe7`, GPL-3.0), Mesen2 (https://github.com/SourMesen/Mesen2 @ `b9fa69ddc6d0a331fb103fdb5eef6904305703c2`, GPL-3.0) and game-music-emu (https://github.com/libgme/game-music-emu @ `f68963b1de0633149b05732113d3c3113c6f63a1`, LGPL-2.1). Nothing was moved: no closed-box tree was in this repository.