# 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 or unlicensed code; facts about the chip are not code; other emulators may be run as closed boxes; permissive sources are used with their notice kept. No GPL source was opened for this audit beyond licence lines: to learn where `_multiply.py`'s notice came from, NanoBoyAdvance's `src/nba/src/arm/handlers/arithmetic.inl` was searched (grep) for its SPDX, copyright and permission lines only. Evidence otherwise is this repository's own records (`docs/undocumented-behavior.md`, `docs/validation.md`, `scripts/pinned_repos.json`, docstrings). The Phase 0 and build work read NanoBoyAdvance's ARM core (GPL-3.0) as documented practice: the docs name its functions (`ARM_BlockDataTransfer`, `GetSPSR`, `ReloadPipeline*`, `MultiplyCarrySimple/Lo/Hi`, the `mask_irq` latch). ## Summary | Verdict | Count | | --- | ---: | | clean | 11 | | cite | 4 | | rewrite | 1 | | unclear | 2 | ## The core (`src/arm7tdmi_python/`) | Piece | Where its behaviour came from | Source licence | Verdict | | --- | --- | --- | --- | | `_tables.py` (generated by `scripts/gen_tables.py`) | data-sheet encoding diagrams (DS figure 4-1, chapter 5); where an index is ambiguous, "the order of the checks is NanoBoyAdvance's" so the corpus compares | ARM documents; NBA GPL-3.0 (ordering only) | clean (a check order over encodings is a fact about which encodings exist; the corpus, MIT, shows it closed-box) | | `_alu.py`, `_psr.py`, `_branch.py`, `_block.py`, `_swap.py`, `_transfer.py`, `_exception.py` (documented paths) | DS, TRM chapter 6 cycle tables, GBATEK; checked by SingleStepTests ARM7TDMI (MIT, generated from an NBA fork), jsmolka (MIT) and alyosha-tas (MIT, hardware-verified) ROMs | documents; MIT | clean | | Behaviour the documents leave out, implemented as "NBA's model": invalid mode banking (U15, `_core.py`), the LDM^ glitch window (U7, `_core.py`), R15 bit 0 cleared every instruction (U20), R15 as a multiply operand reads +12 (U12, "NBA's ordering, which the core copies"), LDRD/STRD write-back (U21, `_transfer.py`), NV never passing (U19, `_modes.py`), SWP bus marking, `disasm.py` decode choices "as NBA decodes them" | read from NanoBoyAdvance's ARM core; the corpus (generated from NBA) shows the same results closed-box | GPL-3.0 (read) | **unclear**: these are behaviours, and the MIT corpus exposes them, but they were written with NBA's source open. Settle by running `provenance_check.py --repo src --reference reference/src/NanoBoyAdvance/src/nba/src/arm` (reading NBA is this repository's documented practice; the run was refused by this audit session's permission system, so it was not done), and by re-sourcing each behaviour to the corpus and the hardware-verified ROMs rather than to NBA's code. | | `_multiply.py` carry functions (`carry_full`, `carry_low`, `carry_high`) | "a transcription of that algorithm, altered from its original form (C to Python, renamed)", with the zlib notice "Copyright (C) 2024 zaydlang, calc84maniac" kept. That two-author version is found only in NanoBoyAdvance's `arithmetic.inl`, inside a block carrying the same zlib notice (the file as a whole is GPL-3.0-or-later); zayd's `multiplication-algorithm` repository (zlib, `LICENSE`) names zaydlang alone | zlib (the block's own notice) | cite: clean under zlib with the notice kept, as it is. Residual: confirm that the transcribed lines lie inside NBA's zlib-noticed block and none come from NBA's surrounding GPL glue (provenance_check against NBA would show it). | | `_multiply.py` cycle count `m` | TRM 6.20, DS 4.8.3; zayd's model (zlib) as judge | documents; zlib | clean | | `access.py`, `cpu.py`, `harness.py`, `debug.py`, `console.py`, `trace.py`, `state.py`, `__main__.py` | own | — | clean | | `disasm.py` | DS mnemonics; judged against mGBA's disassembler (MPL-2.0, run), MAME `unidasm` and GNU objdump (run) | closed box | clean (provenance_check vs ares, SkyEmu, MAME: mnemonic and condition names only) | | SPDX headers | none in `src/` | — | cite: add `SPDX-License-Identifier: MIT`; `_multiply.py` also `Zlib` for the carry functions | ## Validation, tests and tools | Piece | Source | Licence / terms | Verdict | | --- | --- | --- | --- | | SingleStepTests ARM7TDMI | fetched, not committed | MIT | clean | | jsmolka gba-tests, alyosha-tas gba-tests, mGBA suite | fetched, not committed | MIT | clean | | FuzzARM | fetched, not committed | GPL-3.0 (run only) | clean | | ARMWrestler | fetched, not committed | none stated (run only) | clean | | `referees/nba/nba_sst.cc`, `referees/nba/shim/*` | own driver linking NBA's ARM core; the shim headers re-declare NBA's `Bus`, `Scheduler`, `SaveState` interfaces (enum values, method signatures) | NBA GPL-3.0 | cite: a GPL-3.0 tool (charter rule 6, README line 95 says so); give the shim headers and driver a `GPL-3.0-or-later` SPDX header crediting NanoBoyAdvance | | `referees/mgba/*` | own driver around mGBA's decoder; one re-declared prototype | MPL-2.0 | clean (driver is own; built locally) | | `referees/multiply/mul_model.c`, `scripts/multiply_model.py` | own wrapper around zayd's `impl.h` (zlib) | zlib | clean | | `tests/hw/thumb_undefined/` | own test ROM; `build.py` holds and the committed `thumb_undefined.gba` contains the 156-byte Nintendo logo at 0x04-0x9F, as gbafix inserts | Nintendo artwork | **unclear (policy, charter rule 9)**: the logo is required for a GBA to boot the ROM and is universal homebrew practice, but it is console-maker artwork. Aubrey decides whether it may be committed, or whether `build.py` should read it from the player's BIOS or a cartridge at build time. | | `docs/undocumented-behavior.md`, `docs/timing.md` | name NBA functions and describe its code paths (`mask_irq` latched before executing, writes back "after the first transfer", reads "with width 8") as evidence | GPL-3.0 | **rewrite (docs)**: keep the closed-box comparison results (NBA run as referee, corpus counts) and hardware-ROM evidence; drop descriptions of NBA's code. | | `scripts/pinned_repos.json` | records zayd's `multiplication-algorithm` licence as "none stated" | the checkout's `LICENSE` is zlib | cite: correct the record to zlib | ## provenance_check runs (2026-11-13) - `--repo src --reference reference/src/ares` (ISC): 5 file pairs, all condition names, mnemonic lists and the mode numbers (16 17 18 19 23 27 31): facts. - `--repo src --reference reference/src/SkyEmu` (MIT): 2 pairs, same kind. - `--repo src --reference reference/src/mame` (arm7 core, BSD-3-Clause): 2 pairs, same kind. - `--repo src --reference reference/src/multiplication-algorithm` (zlib): 0 pairs. - Not run: NanoBoyAdvance (GPL-3.0; attempted, refused by the session's permission system), mGBA (MPL-2.0). ## History Private repository (alewman/arm7tdmi-python), branch `master` only, no tags, not on PyPI. Everything above has been present since the core was built (`0c6c2fe`, 2026-10-22; the logo ROM since `4d8d2ab`, 2026-10-22). No file was deleted. Nothing needs a history rewrite unless the repository goes public. ## Citation-only fixes made in this audit None (the `pinned_repos.json` correction is listed, not made). ## Wave 2 (2026-11-19): rewritten in place **Mode: in place.** The audit found NanoBoyAdvance's ARM core read during the build, but as a consultant for the gaps ARM's documents leave, not as the working model: the documented paths rest on the DS, the TRM's cycle tables and GBATEK and were judged clean. The flagged pieces were a set of functions and two documents, so they were removed and rewritten; a restart was not needed. The rewriting session did not open NanoBoyAdvance's or mGBA's source, the removed code, or this repository's history of it. **How.** Every function carrying a flagged behaviour (U7, U12, U15, U19, U20, U21, SWP, the multiply carry, the disassembler's decode choices) and every module whose header named NBA was moved aside unread by AST name into a git-ignored `trash/` (commit `a03136b`), then written again from: ARM's data sheet (DS) and TRM, GBATEK, zaydlang's zlib multiply model, alyosha-tas's and jsmolka's MIT test ROMs (their hardware results in prose and in the ROMs' verdicts), the SingleStepTests corpus (MIT) run as data, and NanoBoyAdvance 1.8.3 run closed box (one new measurement: U21). Rules resting only on closed-box evidence are tagged OBSERVED in the code and listed in undocumented-behavior.md "Open items". | Piece | New source | Verdict | | --- | --- | --- | | `_core.py` `_reg`, `_set_reg`, `_switch_mode`, `_get_spsr`, `_refill`, `_execute_arm`, module docstring; `step()`'s glitch window | TRM 2.6 (banks), TRM 3.3 and tables 6-1 to 6-3 (refill); U15 invalid modes as User banking (HYPOTHESIS, the corpus passes); U20 low bits kept (OBSERVED, corpus); U7 window (TEST ROM) | clean | | `_modes.py` `BANK_INVALID`, `condition_passes` | DS table 4-2; NV never (OBSERVED, corpus) | clean | | `_block.py` (all: LDM, STM, PUSH, POP, LDMIA, STMIA) | DS 4.11, 5.14-5.15; GBATEK "Strange Effects on Invalid Rlist's" (empty list, base in list); U7 User-bank transfer (DS 4.11.4), write-back to the User bank's Rn (OBSERVED, corpus); **the LDM^ glitch re-established from alyosha-tas `LDM/ReadMe.txt` ("tested on GBP") and its eight ROMs, all now pass (the removed version passed 4)**; POP {PC} bit 0 (OBSERVED, corpus) | clean | | `_psr.py` (MRS, MSR) | DS 4.6; four-field mask, T and reserved bits (OBSERVED, corpus); M4 forced to 1 (TEST ROM, alyosha-tas `psr` ReadMe) | clean | | `_swap.py` | DS 4.12, TRM table 6-14; R15 operands +12 and Rd = R15 refill (OBSERVED, corpus) | clean | | `_exception.py` | DS 4.13-4.18, TRM tables 6-15, 6-19 to 6-21; CP14 (TEST ROM, alyosha-tas `Coprocessor_14`) | clean | | `_multiply.py` `booth_multiply` (replaces `carry_full`/`carry_low`/`carry_high`) | transcribed from zaydlang's `multiplication-algorithm` `impl.h` (zlib, commit 29cef09) read in its own repository, notice kept in the file and in `NOTICE`; SPDX `MIT AND Zlib` | clean (cite) | | `_multiply.py` instructions, U12 | TRM 6.20, DS 4.7-4.8; R15 operands +12 and Rd = R15 refill (OBSERVED, corpus); operand read order per cycle (TEST ROM, alyosha-tas `LDM_MUL_*`) | clean | | `_transfer.py` `_arm_ldrd`, `_arm_strd` (U21) | no document; OBSERVED by running NanoBoyAdvance 1.8.3 closed box on 98 synthetic cases per encoding (no access, 2 or 1 internal cycles, write-back) | clean (OBSERVED only) | | `_alu.py` `_hi_operands`, `_branch.py` `_thumb_bx` (U19) | DS 5.5; TEST ROM alyosha-tas `thumb/cpy`, `thumb/blx` | clean | | `access.py` `gba_access` | TRM 3.3.4; user decision 1 (C1) | clean | | `disasm.py` `_arm_multiply`, `_arm_swp`, `_arm_halfword`, `disassemble_arm`, `_thumb_hi`, `_thumb_undefined` | DS encoding diagrams and the core's tables; judged by `scripts/disasm_judge.py` (mGBA closed box, MAME `unidasm`, objdump, GNU as): no unexplained differences | clean | | `scripts/gen_tables.py` ordering note | re-sourced to the corpus (OBSERVED) | clean | | `docs/undocumented-behavior.md` | rewritten: NBA code descriptions and mGBA source reading removed; every item tagged DOC / TEST ROM / OBSERVED / HYPOTHESIS | clean | | `docs/timing.md`, `validation.md`, `start-here.md`, `disassembly.md`, `README.md`, `handoff-brief.md` | lines describing NBA's or mGBA's code removed or re-sourced; the brief marked historical | clean | | `referees/nba/*` | SPDX `GPL-3.0-or-later` crediting NanoBoyAdvance; `referees/README.md`; moved out of the repository 2026-11-22 (below) | cite (a GPL tool, charter rule 6) | | `referees/mgba/*` | SPDX `MPL-2.0` | cite (an MPL tool) | | `tests/hw/thumb_undefined/` logo | the 156-byte logo removed from `build.py` (now a SHA-256 check) and the built `.gba` untracked; the build copies the logo from a cartridge image the player supplies (`--logo-from` / `GBA_LOGO_FROM`); reproducible (`fb226f92…`). History still holds both (`4d8d2ab`): a history rewrite is owed before any publication | clean going forward | | `scripts/pinned_repos.json` zayd entry | licence corrected to Zlib | clean | **Behaviour that changed.** (1) The LDM^ glitch: the removed version opened a window over the next bus cycles and wrote to both banks; the new one ORs only the first-cycle register reads of the next instruction and writes to the current bank, as the hardware ROMs require (8 of 8 pass, was 4 of 8; the corpus cannot see it). (2) The disassembler marks post-indexed halfword transfers with W = 1 and SWP with bit 23 set as nonstandard (147 more encodings classed so). Everything else scores as before: corpus 2,192,923 of 2,192,923, I cycles against NBA identical (2,118,750 agree, C5 74,016, C11 156), multiplies 7,000,000 of 7,000,000. **Owed / open.** U7's window is not in `CPUState` (a save state taken between an LDM^ and the next instruction loses it). gba-python pins this core and must re-pin to pick these changes up (`gba_access` and the public API are unchanged). The history held the removed code and the logo: it was reset to one commit on 2026-11-22 (below). ## History reset (2026-11-22) The history clean-up (wave E) reset this repository to a single commit of this tree: the removed history held the NBA-read code that Wave 2 rewrote, the logo ROM `4d8d2ab` and the owner's full name in commit metadata. Before the reset, the NBA referee's driver and shim headers (`referees/nba/`, GPL-3.0-or-later) left the tree: a GPL tool is kept outside an MIT repository (owner's ruling 4 of 2026-11-20). `scripts/build_referees.py` builds it from `$EMU_TOOLS_GPL/tools/arm7tdmi-python/nba/` (`EMU_TOOLS_GPL` names a checkout of emu-tools-gpl; until 2026-11-24 the folder was named by `ARM7TDMI_GPL_TOOLS`), and skips it when that is unset. `tests/hw/thumb_undefined/run_referees.py` finds gba-python's drivers through `GBA_PYTHON_ROOT` and the BIOS through `NO_INTRO_DIR`. Commit hashes cited in these documents (`0c6c2fe`, `4d8d2ab`, `a03136b`, `51bb589` and the others) refer to the removed history, which is kept privately as the record of what was removed. ## Closed-box sources reviewed (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, unless it is built into a program that has no shipped build. Both closed-box pins here are of that kind and stay, never opened, with the question of moving them to emu-tools-gpl left to Aubrey: - NanoBoyAdvance (https://codeberg.org/nba-emu/NanoBoyAdvance @ `e8482c1efc6c`, GPL-3.0): its ARM core is compiled into the NBA referee (driver in `$EMU_TOOLS_GPL/tools/arm7tdmi-python/nba/`); no shipped build of the core alone exists. - mGBA (https://github.com/mgba-emu/mgba @ `fd9dc5c2cbf2`, MPL-2.0): its decoder is compiled into `referees/mgba/`, an MPL-2.0 tool inside this repository; no shipped build exists. Whether that tool should move to emu-tools-gpl is the same open question. No passage quoting their internals was found outside this file's own records (mGBA's `ill` in docs/disassembly.md is its printed output, OBSERVED).