# Tools ## `run_rom.py` A headless runner for `famicom-python`: loads a ROM, runs frames, writes screenshots, reports PC and PPU mask, and optionally records every write in a chosen address range. Environment: - `FAMICOM_PYTHON_SRC` — the `src` directory of `famicom-python` (required). - `FAMICOM_DEPS` — path-separated dependency `src` directories (`6502-python`, `ym2413-python`, `ay8910-python`, `z80-python`, as needed). - `NES_PALETTE` — a `.pal` file; the `play-nes` repository has `2C02G_U_wiki.pal`. Without it, screenshots are skipped. Example: ``` python tools/run_rom.py "$NO_INTRO_DIR/No-Intro/Nintendo - Nintendo Entertainment System (Headered)/Golden Game 260-in-1 (Taiwan) (En) (Pirate).zip" \ --frames 600 --shots 300,600 --out evidence --trace evidence/writes.jsonl ``` Input can be scripted at a frame: ``` python tools/run_rom.py "$ROM" --frames 900 --shots 600,900 \ --press 600:A:4 --out evidence ``` For the experimental 559 mapper: ``` python tools/run_rom.py "$ROM" --frames 600 \ --install-module mappers/559-sangokushi-subor/experiments/partial_mapper.py ``` ## `make_mirror_test.py` Builds a synthetic mapper-235 CIRAM test ROM. The output is always outside this repository (`*.nes` is ignored). No game data is used. Green/red/blue on screen mean horizontal/vertical/one-screen mirroring; see `mappers/235-golden-game/mirror-test.md` for the acceptance test and results. ``` python tools/make_mirror_test.py --header-prg 64 --out /m235_1m.nes python tools/make_mirror_test.py --header-prg 64 --no-latch --out /m235_1m_none.nes ``` ## `make_r_test.py` Builds a mapper-235 R/P bank-marker ROM. The output stays outside the repository; it is not a game ROM. It writes one latch address from a RAM loop; read `$8100` and `$C100` for the lower/upper 16 KiB bank numbers. This proved the 100/260 dumps use the opposite R mapping to the public 150-in-1 note. ``` python tools/make_r_test.py --target r1p0 --out /r1p0.nes ``` ## `diff_dumps.py` Lists the bytes a pirate dump changed from the licensed release it was made from, bank by bank. Patched stores name the original's registers and the pirate's replacements; this is how 559 was read (audit entry 16). Only the summary is kept as evidence, never the byte listing (it is the publisher's code). ## `dis6502.py` A small 6502 disassembler for one 8 KiB PRG bank of a `.nes` or `.zip`: ``` python tools/dis6502.py "$ROM" 31 E000 E000 -20 ``` Arguments: bank, the CPU address the bank is viewed at, the first address, the instruction count (negative stops at the first RTS/RTI/JMP). ## `provenance_check.py` Runs the mechanical part of the release check: no ROMs/archives, no GPL/LGPL code headers, no machine paths or private mirror names, and a LICENSE file. ``` python tools/provenance_check.py ``` ## Evidence Screenshots, short traces and disassembly notes belong next to the mapper page. No ROMs. Large raw traces go outside git with a manifest; the audit log says where they live.