# a7800-python **Lineage:** a7800-python → (a7800-rust, planned) · fixes start in a7800-python and flow down by merges · [family charter](https://github.com/alewman/emulator-lineage/blob/main/docs/charter.md) A readable, pure-Python emulator of the **Atari 7800 ProSystem**, to be built as a board on [6502-python](https://github.com/alewman/6502-python). The core owns the instruction set (SALLY is an NMOS 6502 with a HALT pin); this repository will own MARIA (display lists, line RAM, the DMA that stops the CPU, the DLI, WSYNC, the clock that runs the CPU at 1.79 or 1.19 MHz), the INPTCTRL latch and both memory maps, the cartridge connector with its schemes, and one loader for every file format people have. The TIA, the RIOT and the whole 2600 mode come from `a2600-python`, pinned (since 2026-11-14 the rebuilt project at `28fb095`, which answered this board's four socket requests: docs/status.md "The a2600-python repin to 28fb095"); POKEY from `pokey-python`. **Status (2026-11-13, session 8): milestones 1, 2 and 6 passed; 3, 4, 5, 7 and 8 passed in part.** 2026-11-14: a2600-python repinned to `28fb095`, its answers to this board's four requests adopted (2600 mode is now a real a2600-python `System` on the adopted SALLY); every gate unchanged except Pitfall II's music on the PAL row, now at the cartridge's own rate (docs/status.md). Session 8: Rescue on Fractalus's mirror RAM checked against Stolberg and the dump's own accesses (the board was right; MAME's shows host memory, C24); milestone 2 passed (Centipede, Asteroids, Ms. Pac-Man against ProSystem classed by game state); milestone 4's deep scenes by scripted input (Pole Position II's track choice and Summer Games' diving reached and judged; M.I.A. level 2 and Karateka's second enemy not reached) with a new game-state judge; milestone 5's two-button default and Crossbow's light gun judged. Session 7: C23's reading of sheet 17 checked by an independent second reading (it stands; only Dark Chambers of the 110 dumps ever takes the second NMI); milestone 4's six differing titles classed (no board fault; in Kung-Fu Master MAME's DLI entry is what breaks its colours); Dig Dug's and Robotron's frames against ProSystem classed by per-frame RAM. Session 6: C23 settled from the gate-level diagrams (sheet 17: the last line's DLI is raised, and its flag raises a second NMI after the next VBE fetch; every emulator differs); milestone 4's scripted scenes against MAME (8 of 16 titles match in every compared frame, deep scenes not reached); banksets built and judged by the designers' test suite; a pygame-ce window with cool/warm/hot palettes and a composite option, judged headless (`python -m a7800_python.frontend CART [--palette hot] [--composite]`, needs pygame-ce); the PAL DMA probe figures. The board boots the NTSC and PAL BIOS, runs licensed cartridges with MARIA's DMA (linear, SuperGame and its options, Activision, Absolute, POKEY at $4000) and runs 2600 cartridges in 2600 mode through `a2600-python`, whose gates pass through it. Of the 110 licensed dumps typed with certainty, all 110 run to frame 400 from their BIOS and 104 show a picture (the other six explained); at that frame 45 of 56 NTSC and 30 of 37 PAL dumps are pixel-exact against MAME 0.285, every other one classified (Rescue on Fractalus: MAME's mirror RAM shows host memory, C24). Sound: `--wav` writes the TIA + POKEY mix (a fit); Commando's 60 s of POKEY writes equal MAME's, Ballblazer's to 10.3 s (then RANDOM, C22), both unchanged on the restarted POKEY core (pokey-python `6ed1ffa`, adopted 2026-11-14: docs/status.md "The POKEY core swap"). The light gun is judged by Barnyard Blaster. What passes, with its judge and measured numbers, is in [docs/build-progress.md](docs/build-progress.md). The documents in [`docs/`](docs/README.md) gather what the build needs, each fact with its source and tier; the build follows [docs/handoff-brief.md](docs/handoff-brief.md). What Phase 0 found, in short: - **MARIA has no die-level judge.** The best evidence is GCC's gate-level logic diagrams and chip specification, console measurements reported by developers, and an FPGA core transcribed from the diagrams. GCC's own layout files for the chip survive but nothing reads them today. - **SALLY's HALT** stops the CPU for whole cycles before any cycle, writes included; WSYNC is RDY and stretches reads. `6502-python` needs no change. The 5200 board reached the same finding independently ([docs/timing.md](docs/timing.md)). - **A headerless dump cannot say what hardware its cartridge has.** Typing by payload hash from MAME's CC0 software list covers 126 of the 245 local No-Intro cartridges; no `.a78` header exists anywhere on this machine ([docs/cartridge.md](docs/cartridge.md)). - MAME 0.285 and ProSystem run here headless as detectors; MAME does not model the slow cycle and charges DMA in one lump per line ([docs/mame-oracle.md](docs/mame-oracle.md)). ## Scope | Machine | Phase | | --- | --- | | NTSC 7800 with the 4 KiB BIOS | first | | PAL 7800 | a machine row from the start, certified later | | 2600 mode | a milestone of its own, judged by `a2600-python`'s gates | | Cartridges: linear, SuperGame and its options, Activision, Absolute, High Score Cartridge | milestones 1 and 3 | | POKEY carts, controllers | milestone 5 | | Banksets (built, session 6); XM, SOUPER, Covox | milestone 7 | ## What is fetched Nothing third-party is committed. `scripts/fetch_references.py` rebuilds `reference/` from `scripts/pinned_files.json` (60 files by SHA-256) and `scripts/pinned_repos.json` (10 repositories at full commits): ```sh python scripts/fetch_references.py # everything missing python scripts/fetch_references.py --verify # check what is present ``` It needs `git` and `curl`. Wiki and forum snapshots are reported when changed and kept; everything else must match its hash. ## Install The pins are in `pyproject.toml` (6502-python `741419a`, a2600-python `28fb095`, which pins the same 6502-python, pokey-python `6ed1ffa`; since 2026-11-22 the same code as 6502-python `828b619`, a2600-python `4ad24f2` and pokey-python `ea20096`, after 6502-python's history rewrite), all from GitHub, and a plain install resolves them: ```sh pip install -e ".[dev]" ``` (Re-pinning an existing venv: `pip install --force-reinstall --no-deps ""`, then check `pip freeze`; an unchanged version string otherwise keeps the old install.) ## Scripts | Script | What | | --- | --- | | `scripts/fetch_references.py` | the pinned references and test programs | | `scripts/count_carts.py` | census of the local dumps by payload hash: formats, schemes, sound hardware, how many can be typed and from what ([docs/cartridge.md](docs/cartridge.md)) | | `scripts/mame_trace.py` | MAME 0.285 per-instruction SALLY trace with TIA, MARIA, RIOT and cartridge accesses, from a No-Intro zip in place ([docs/mame-oracle.md](docs/mame-oracle.md)) | | `scripts/prosystem_run.py` | a locally built ProSystem libretro core through `ctypes`: frame digests, a PNG, RAM ([docs/validation.md](docs/validation.md)) | ROMs and BIOS images are bring-your-own, read in place, located by hash, through environment variables (no machine path is kept here, `src/a7800_python/romsets.py`): | Variable | Folder below it | Used for | | --- | --- | --- | | `NO_INTRO_DIR` | `Atari - Atari 7800 (BIN)`, `... (BIN) (Aftermarket)`, `... (BIN) (Private)`; `Atari - Atari 2600` | cartridges, 2600 mode, the census, the detector runs | | `MAME_ROMPATH` | `a7800.zip` (NTSC BIOS), `a7800p.zip` (PAL BIOS) | the BIOS start, MAME's `-rompath` | | `RETROBAT_DIR` (optional) | `atari7800` | the census scripts' fourth set only | Scripts stop with a message naming the variable when it is unset; tests that need a dump or a BIOS skip, naming it. `scripts/gates_2600.py` finds a2600-python's checkout beside this repository (`../a2600-python`, `--root` overrides). ## Licence MIT (see `LICENSE`) for what is in this repository; every source file carries `SPDX-License-Identifier: MIT`. `NOTICE` lists the permissive sources whose material is kept here, with their notices: MAME's CC0 software list (the cartridge table's seed rows), facts from MAME's BSD-3 7800 files, and k7800 (MIT). Fetched material keeps its own terms, recorded per pin; provenance is in [docs/provenance.md](docs/provenance.md).