# Provenance ## Licence provenance (audit 2026-11-13) An audit of where each part of this board's behaviour came from, and whether the repository can honestly carry the MIT licence (family charter, "Licences and provenance"). Judged from the repository's own records: comments, docstrings, the quirk records of `machine.py`, docs, commit messages, `scripts/pinned_*.json` and the licence files of the pinned references. No GPL, LGPL or non-commercial source was opened for the audit. Verdicts: **clean** (own work from facts or permissive sources, cited), **cite** (clean, but a notice or a source name is owed), **rewrite** (derived from code the family may not take), **unclear** (what would settle it is named). ### The finding in one paragraph This board is built from Sega's 32X Hardware Manual (specification), notaz's testpico (public domain, run on his console: hardware-corrected) and Sega's Mars Check Program (run, not shipped), and it records every behaviour as a `Quirk` with its source and tier (`machine.py`): 81 records, of which 24 rest on hardware-corrected tests, 28 on the Manual, 4 on research, 14 are labelled assumptions and **11 rest on emulators**. The emulators' sources were opened: `machine.py:14-15` "**ares**, **PicoDrive**, **jgenesis** = the pinned emulator sources, read for behaviour only, never copied", and BlastEm, the MiSTer core and Genesis Plus GX are cited by function too. ares is ISC (usable with notice); PicoDrive is non-commercial; jgenesis and BlastEm are GPL-3.0; the MiSTer core is GPL. No transcription was found (comparison below: prose only), but the emulator-tier choices that rest on a non-permissive source alone are **unclear** under charter rule 3. ### Summary | Verdict | Count | | --- | ---: | | clean | 10 | | cite | 3 | | rewrite | 0 | | unclear | 3 | ### Per module | Part | Behaviour from | Licence | Verdict | | --- | --- | --- | --- | | `machine.py`, 70 quirks on hardware-corrected tests, the Manual, research, or labelled assumptions | testpico (public domain), Mars Check Program (run), Manual, service manual, forum research | facts; public domain | clean | | `machine.py`, emulator-tier quirks that ares also supports: `pwm_period` (cycle - 1), `pwm_byte_writes`, `pwm_cycle_write`, `hcount_read` | ares (with PicoDrive, jgenesis, BlastEm agreeing) | ISC | **cite**: name ares as the source and keep its ISC notice | | `machine.py`, emulator-tier quirks with no permissive source: `pwm_fifo` (pop at the period's end: PicoDrive, jgenesis, BlastEm; ares pops at its start), `pwm_timer_restart` (PicoDrive), `pwm_dreq1` (a reading across ares/jgenesis/MiSTer), `screen_shift_modes` (PicoDrive and jgenesis; ares shifts packed pixel only), `sh2_area0_width` (the MiSTer core's pin ties), `framebuffer_mirror`, `cartridge_boards` (jgenesis `metadata.rs`) | PicoDrive, jgenesis, BlastEm, MiSTer | non-commercial, GPL-3.0, GPL | **unclear**: each wants a hardware-corrected test, an ares citation, or a closed-box run on the referees (all four are already built here and run as detectors) | | `machine.py` text fields | quote other emulators' source comments and identifiers ("FEN seems to be randomly pulsing on hcnt", "Only writes to odd address send a value to FIFO", "hw bug: shift flag doesn't work if line addr ...", jgenesis's "verified on hardware") | | **unclear** (policy: is a source comment saying "verified on hardware" a usable second-hand fact under the middle rule, and may short attributed quotes stay?) | | `vdp.py` | the Manual's figures 3.15-3.17 and section 3.3 for the line timing, read against megadrive-python's video sockets; quirks above | facts | clean (inherits the quirks' verdicts) | | `composite.py` | Manual priority rules; the H32 offset of 26 MCLK, which ares, PicoDrive and jgenesis give | ISC (ares) | **cite** (ares) | | `pwm.py` | Manual 3.2.1, 3.2.2, 3.4 and chapter 5; quirks above | facts | clean (inherits the PWM quirks) | | `slot.py`, `sh2side.py` | Manual 3.1, 3.5; testpico; megadrive-python's sockets | facts; public domain | clean | | `console.py` | the Acclaim EEPROM cartridge "Genesis Plus GX `mapper_acclaim_32M_write16`" (l.34) | non-commercial | **unclear**: megadrive-python's own Acclaim board (audited there) or a cartridge document | | `bootrom.py` | SHA-1s of the No-Intro / MAME dumps; the ROMs are bring-your-own and never fetched or committed | facts | clean | | `savestate.py`, `runner.py`, `harness.py`, `__main__.py` | own work | n/a | clean | | `scripts/` | own tools: referee builds, libretro frame grabber, comparisons, SH-2 lockstep. `nmd_edclk_probe.c` is our glue (MIT) linked against megadrive-python's pinned Nuked-MD (GPL-2.0) in a scratch build that is never distributed | n/a (a tool) | clean as a tool; see the note on Nuked-MD below | | `tests/` | own tests | n/a | clean | | docs | own prose; MAME's Mars Check table (`mega32x.cpp`, BSD-3) matches the rows in `validation.md` because both list Sega's program | BSD-3 | **cite** (counted with `composite.py`'s row above: three cite items in all, with ares's quirks) | `vdpregs.py` (removed in `f3967fe`) put the bitmap mode register's PRI and 240 bits "at 7 and 6, PicoDrive's and jgenesis's positions"; the choice is now `Quirks.bitmap_bits`, tiered to the Manual. Nothing else was ever deleted. ### Nuked-MD `scripts/nmd_edclk_probe.c` names Nuked-MD internals (`FC1004_Clock`, `arbiter.c ARB_ClockEDCLK`, quoted in `machine.py:594`), so its source was read, and the EDCLK measurement on it (worklog Session 9) informs `Quirks.edclk_h32`. Nuked-MD is GPL-2.0 and die-derived; its credits name no author who objects to AI use. The restart rules leave "a closed-box model as a measuring instrument" unruled (so, for now, no); the quirk's choice is also what ares, jgenesis and BlastEm draw, so it can be re-cited to ares and the Nuked-MD reading kept as a detector note. **unclear** until Aubrey rules (counted with the `machine.py` text item). ### Dependencies `megadrive-python@5c6d1b7`, `sh2-python@d4665d5` (audited separately). **megadrive-python 5c6d1b7 pins the archived Nuked-derived sound cores** (`ym2612-python@2c2ab23`, `sn76489-python@b0acbc8`): repin to a megadrive-python revision on the restarted cores before anything ships. ### History findings Private on GitHub. Only this project's text files were ever committed; no boot ROM, cartridge or capture. `reference/free-bios/` pins two free 32X boot ROM replacements (the "poor man's" BIOS with SNASM source, and fedex81's homebrew patch); neither is committed or used by the code. ### Check runs `provenance_check.py` (pcengine-python) against `ares` (ISC), `marsdev` (MIT) and `mame`: one hit, the Mars Check row list against `mega32x.cpp` (BSD-3). Then, because reading them is this repository's documented practice (`machine.py:14-15`), against PicoDrive, jgenesis and BlastEm: five file pairs, **all prose**: PicoDrive's comments quoted in `machine.py:568-569, 875, 983` and in `undocumented-behavior.md`, `timing.md`. No code-shape or table hit. ## Wave-2 rewrite (2026-11-19): in place Chosen **in place**: the flagged pieces were named records and one module, and the rest of the board rests on the Manual, testpico and the Mars Check Program. Rules: `emulator-lineage`'s wave-2 rewrite rules, including the owner's ruling of 2026-11-19 ("verified on hardware" must be accurate; no 32X hardware here, so nothing is MEASURED unless a cited hardware source says so). | Item | Was | Now | New source | Behaviour | | --- | --- | --- | --- | --- | | `pwm.py`, `tests/test_pwm.py` | written with closed emulators' PWM open | moved aside unread (`trash/`), rewritten | Manual 3.2.1, 3.4 (OCR'd), System Overview p.33, ares (OBSERVED) | changed: FIFO pops at the period's start; TM count restarts only on an SH-2 TM write; level is the duty of width - 1 (Manual); socket 8 always yields samples. PWM demo against the old: correlation 0.994-0.997, rate and samples per frame identical | | `pwm_fifo`, `pwm_timer_restart`, `pwm_dreq1` | **unclear** (closed sources only) | records rewritten unread | Manual 3.4; System Overview; ares | provisional; first two changed (above) | | `pwm_period` | cite (ares) | the Manual 3.4 states cycle - 1 | DOC | unchanged | | `pwm_byte_writes`, `pwm_cycle_write`, `hcount_read` | cite (ares) | ares cited, NOTICE | OBSERVED | unchanged | | `screen_shift_modes` | **unclear** | rewritten | 32XDK wiki (document), ares | **changed**: packed pixel only (was all three modes) | | `sh2_area0_width` | **unclear** (GPL HDL pin ties) | rewritten | SH7604 HM 7.2, Manual 4.1, ares's 16-bit bus; boot ROMs run | 16, unchanged; HYPOTHESIS until the service manual's schematic is read | | `framebuffer_mirror` | **unclear** | rewritten | 32XDK wiki (prototype use, ares issue 744), ares | unchanged | | `cartridge_boards` | **unclear** (jgenesis `metadata.rs`) | rewritten | Eke-Eke's gen_eeprom.pdf (document), MAME `eeprom.cpp` (BSD-3), the images' headers | NFL Quarterback Club and NBA Jam TE on `rom_nbajamte` | | `console.py` Acclaim board | **unclear** (GPGX mapper) | the ROM/EEPROM switch at $200000 removed unread; /SDA wired AND kept | NXP UM10204 3.1.1 and the 24LC02B data sheet (open-drain SDA); MAME's model (EEPROM always at $200000) | **changed** (see the worklog for NFL Quarterback Club) | | `edclk_h32` | **unclear** (Nuked-MD probe written against its source) | probe moved aside (`trash/`), record rewritten | spritesmind t=519 (Jorge Nuno, scope) and t=851/t=1291 (Nemesis): EDCLK made outside the VDP; ares; the slow run's place derived from megadrive-python's own line records | **changed**: 368 MCLK (was 374), HYPOTHESIS | | `composite_alignment` | cite / Nuked-derived H32 30 | H40 0 from Sega's H/W Information; H32 from ares | DOC; OBSERVED | **changed**: H32 26 MCLK (was 30); BlastEm's frames' ~30 recorded as a difference | | `composite_dot`, `hblank_phase` | Nuked-derived text | struck, re-sourced | community findings, ares, the board's own phase scan | unchanged values | | `machine.py` text fields | quoted PicoDrive/jgenesis/BlastEm/MiSTer source | struck; "verified on hardware" emulator comments removed (`screen_shift_ff_exception` rests on Bulletin #14) | | none | | docs | quotes and source readings | scrubbed (ec7d3ce and later) | | none | | SPDX, NOTICE | missing | MIT headers on every own file; NOTICE with ares (ISC) and MAME (BSD-3) | | | **Gates, before (e3bdf84) and after (e483e65 and later):** pytest 102 passed and 102 passed (`SEGA32X_BIOS_DIR` set; tests now skip without it rather than read a machine path); `-m slow` 1 and 1; ruff clean. testpico 260 frames (cold and warm, all twelve 32X tests): frames 110 and 260, composite and 32X, byte-identical before and after (and to the milestone-5b record). Mars Check Program automatic, 760 frames: 51/161 "SH2 MASTER V INTERRUPT OK", ERROR COUNT 0, all 118 kept frames byte-identical before and after. PWM demo, 480 frames, FM off: 352,520 samples at 44,100 Hz both; correlation 0.994 (0-3 s). Against sh2-python's rewritten b327ae0 (its DIVU edge cases changed): pytest 102 passed; the long gates were not run on it. NFL Quarterback Club, 900 frames with two Start presses: all 18 PNGs byte-identical before and after (the Acclaim change does not move it). **Remains unclear:** `sh2_area0_width` (the schematic), `edclk_h32`'s 368 and H32's 26 against BlastEm's 30 (no H32 capture), the PWM pop phase and TM restart (ares only), the screen shift in direct colour and run length. The worklog's dated sessions still quote other emulators' source in places (listed in Session 17); they are history and are superseded by this section. **Downstream:** repin megadrive-python from 5c6d1b7 (archived Nuked-derived sound cores) to a revision on the restarted cores once its own wave-2 rewrite lands, and sh2-python from d4665d5 to its rewrite (b327ae0 or later), then rerun the long gates.