# snes-python A readable, pure-Python emulator of the **Super Nintendo Entertainment System / Super Famicom**, to be built as a board on the family's cores: [65816-python](../65816-python) for the S-CPU's 65C816 and the SA-1, and [spc700-python](../spc700-python) for the S-SMP's SPC700. The cores own their instruction sets; this repository will own everything around them: the S-CPU's address decoder and its 6/8/12-clock bus cycles, DMA and HDMA, the multiplier and divider, the H/V IRQ and NMI timer, the joypad auto-read, WRAM, both picture chips dot by dot, the rest of the S-SMP (IPL ROM, timers, ports), the **S-DSP** as an in-board module, the cartridge maps and coprocessors, and the master clock that ties them together. **Status (2026-11-24): restarted 2026-11-19; milestones 1, 3 and 4 done, 2 built.** The first build (2026-10-23 to 2026-11-13) was written with bsnes, Mesen2 and snes_spc source open; it is archived and this repository was restarted from its Phase 0 ([docs/restart.md](docs/restart.md)). The rebuild uses only anomie, fullsnes, the SNESdev wiki, ares (ISC, see NOTICE), MAME's BSD-3 files, test ROMs and Aubrey's Super Famicom; GPL emulators are run as closed boxes, never read. Milestone 1 (the S-CPU board) passes gilyon's cputest (full 649 and basic 452 "Success") and all 28 of krom's CPU and BANK ROMs; the picture (milestone 2) is built, the sound side (milestone 3) passes blargg's spc_dsp6 111/111. The full compatibility sweep (2026-11-24, f26826f): of the main No-Intro set's 4,089 images, 3,514 match Mesen2's frame 300 exactly within +-30 frames, 339 differ by one 5-bit step (a fade: the brightness curve, U10), 105 by more, 8 stay blank, none crash, and 123 need a coprocessor or mapper not built yet (licensed plain cartridges: 2,807 of 3,162 exact). Numbers: [docs/status.md](docs/status.md); where the build stands: [docs/build-status.md](docs/build-status.md). > **Lineage:** 65816-python + spc700-python → **snes-python** · fixes start in the > cores and flow up by pins · > [family charter](https://github.com/alewman/emulator-lineage/blob/main/docs/charter.md) ## Scope | Machine | Phase | | --- | --- | | SNS-001 / SHVC-001 with 5A22-02 (CPU v2), NTSC: the reference | 1 | | CPU v1, PPU2 v1-3, 1CHIP consoles | 1, as fields | | PAL | later, as machine data | | Coprocessors: DSP-1..4, SA-1, S-DD1, SPC7110, OBC1, S-RTC | after the base board | | Super FX, Cx4, ST018, Super Game Boy, MSU-1, Satellaview | later (own cores where programmable) | ## What is fetched Nothing third-party is committed; ROMs, the IPL ROM and coprocessor programs are bring-your-own. `scripts/fetch_references.py` rebuilds `reference/` and `tests/test_roms/` from `scripts/pinned_files.json` (74 files by SHA-256: fullsnes, anomie's register/timing/memory-map documents, 65 SNESdev wiki pages, gilyon's v1.4 release, undisbeliever's v20210217 release, blargg's 2010 probes, NovaSquirrel's gradient test) and `scripts/pinned_repos.json` (12 repositories at full commit SHAs, sparse where large: ares (readable, ISC); MAME 0.285 (closed box; only its BSD-3 SNES files and the CC0 software lists are fetched), krom's SNES tests, undisbeliever's and gilyon's sources, rainwarrior's SNES_stuff, SnesSpeedTest, the 240p suite, SPLA, Pan Docs' SGB chapters, SameBoy's SGB code, bass-untech). No closed-box source is fetched (Aubrey, 2026-11-24): bsnes, Mesen2, MesenCE, snes9x and SNES_MiSTer are cited by URL and commit only (docs/provenance.md), and Mesen2 runs as the family's GPL tool (below): ```sh python -I scripts/fetch_references.py # everything missing python -I scripts/fetch_references.py --verify # check what is present ``` It needs `git` and `curl`. Wiki pages and fullsnes are live: a changed page is reported and kept; everything else must match its hash. ## Scripts | Script | What | | --- | --- | | `scripts/fetch_references.py` | the pinned references and test ROMs | | `scripts/mame_trace.py` | MAME 0.285 per-instruction 5A22 trace (master clocks, H/V, frame), B-bus and CPU-register log, optional S-SMP trace, ROM-string result detector ([docs/mame-oracle.md](docs/mame-oracle.md)) | | `scripts/mame_screens.py` | test ROMs with a reference picture run on MAME, frames compared at 5 bits per channel | | `$EMU_TOOLS_GPL/tools/mesen2/run.py` | mesen2-runner 0.3.0 (emu-tools-gpl, GPL-3.0-or-later): Mesen2 b9fa69d headless, machine `snes`, frames to PNG (all of a game's checkpoints from one run, `--frames-at`), Lua script logs (`--until log:TEXT` ends the probe suite's run when it finishes), a manifest per run ([docs/validation.md](docs/validation.md)); run as a separate program, found through `EMU_TOOLS_GPL` by `scripts/emu_tools.py` (exit 3 without it) | | `$EMU_TOOLS_GPL/tools/snes-spc/build/spc_dump` | snes-spc 0.1.0 (emu-tools-gpl): blargg's snes_spc 0.9.0 (LGPL-2.1) as the S-DSP referee, built by that tool's `build.sh` (this repository neither fetches nor keeps its source); run by `dsp_compare.py`, `dsp_run_referee.py` and `tests/dsp/test_referee.py`, found through `EMU_TOOLS_GPL` (exit 3, or a skip, without it) | | `scripts/mesen_frames.py`, `scripts/detectors_compare.py`, `scripts/suite_run.py --on mesen` | Mesen2's frames of test ROMs, MAME against Mesen2, the probe suite on Mesen2, all through mesen2-runner | | `scripts/smoke.py`, `scripts/sweep.py` | the smoke list and the full compatibility sweep against Mesen2's frames, classified (docs/status.md) | | `scripts/count_carts.py` | memory maps and coprocessors over a local No-Intro set, read in place ([docs/cartridge.md](docs/cartridge.md)) | Run them with `python -I`; `mame_screens.py` and the Mesen2 scripts need Pillow (the system Python's, which runs mesen2-runner) and `EMU_TOOLS_GPL` (emu-tools `docs/contract.md`, section 5; mesen2-runner finds its library through its own build or `MESEN_CORE`), `mame_trace.py` needs `/usr/games/mame`, `7z` and a `snes.zip` holding the IPL ROM. ## Licence MIT (see `LICENSE`), for what is in this repository; code taken from ares keeps its ISC notice (`NOTICE`). The fetched material keeps its own terms, recorded per file in the pin lists.