# The cartridge: connector, schemes, coverage ## Why the schemes live here A 2600 cartridge is more than ROM: almost every cartridge past 4 KB switches banks, some carry RAM, and a few carry whole chips (the DPC in Pitfall II, the Supercharger's 6 KB of RAM and its tape input). They are cartridge logic, not console logic, so they live in this repository as `a2600_python/cartridge/`, behind the connector below, with a test that forbids imports from the rest of the board (famicom-python's rule, for the same reason: a scheme that reaches into the TIA hides an interaction the connector should show). ## The connector is 24 pins and has no R/W line The cartridge slot carries **A0–A12, D0–D7, +5 V and ground**. That is all (Stella Programmer's Guide; Kevin Horton's bankswitching notes, both in `reference/`). There is no R/W, no φ2 and no chip select: A12 high is the cartridge's whole address decode. Every consequence below follows from that. - **The cartridge sees every bus cycle**, including TIA and RIOT reads and writes, because it sees A0–A12 always. Schemes use that: Tigervision 3F latches a bank on any *write* to $0000–$003F (a TIA address), Activision FE watches for the stack access at $01FE and takes the bank from D5 of the next cycle, the Supercharger counts distinct addresses. - **A cartridge cannot tell a read from a write.** Cartridge RAM therefore uses separate address windows: the Super Chip's 128 bytes are written at $1000–$107F and read at $1080–$10FF; a read from the write window is a write of whatever is on the bus (the classic "SC write on read" bug, which games must avoid and which some test ROMs probe). CBS RAM+ (FA) and M-Network (E7) do the same with their own windows. - **Hotspots fire on any access**, read or write, dummy or real. A `LDA $1FF9,X` with X = $FF makes a dummy read of $1FF8 and switches F8 to bank 0 on the way. 6502-python makes every dummy read at the hardware's address (SingleStepTests bus-exact, 2.56 M cases), so the board gets this for free if it passes every bus call to the cartridge. ### The protocol (milestone 1; extended in milestone 5) One call per CPU cycle, in time order, with the master time (`cartridge/connector.py`): ```python class Cartridge: snoops_reads = False def access(self, address: int, value: int, t: int, write: bool = False) -> int | None: """address: A0-A12; value: the byte on the bus (the CPU's on a write, the floating bus on a read); returns the byte the cartridge drives.""" def snoop(self, value: int) -> None: """The byte that settled on the bus at the end of a read cycle.""" def reset(self) -> None: """A power cycle with the cartridge in.""" ``` `write` is a convenience the hardware does not have. Only a scheme whose document says it reacts to writes alone may read it (3F), tagged HYPOTHESIS for the mechanism; a test lists the schemes allowed. `snoop` exists for FE, which latches D5 of a byte the RIOT drives (an RTS's PCH pull). The board resolves the bus: CPU drive on writes, else cartridge drive, else TIA's two driven bits plus the floating bus ([undocumented-behavior.md](undocumented-behavior.md)). The DPC's music oscillator catches up inside `access` from `t`. Pitfall II reads the DPC's 4-bit music value and writes it to AUDV itself (Horton), so there is no cartridge audio pin. **What clocks the DPC's music oscillator: the cartridge, not the console** (DOC, settled 2026-11-14). Crane's patent US 4,644,495 calls it "an internally generated asynchronous clock signal (42 kHz in the preferred embodiment) OSC generated by clock circuit 31" and "a 42 kHz free running clock", and says "the only signals connected to the cartridge are 12 address lines ..., a chip select line ..., eight data bus lines, and two power supply lines"; nocash's slot pin-out has no clock pin either; Horton found on his own cartridge that a 560 kΩ resistor on the board with a capacitor on the DPC die sets the pitch, and touching the resistor bends it. The console's Φ2 never reaches the cartridge, so the oscillator runs in its own hertz whatever the console's crystal. Only its frequency is uncertain (21 kHz, FITTED by Horton's ear; it varies by cartridge). The model counts it in CPU cycles, so it needs the clock of the console the cartridge sits in: `ticks_per_cycle = music_hz / cpu_hz`. Every row gets its own: `System.from_rom(rom, machine)` passes `machine.timing.cpu_hz` (unless `cpu_hz=` is given), and a host building with `load(..., cpu_hz=)` or `build(..., cpu_hz=)` passes its row's (the 7800 rows the same way). The result is the same pitch on every row: one second of any row's CPU cycles is 21,000 oscillator ticks (`tests/test_dpc_clock.py`, one test per row of `MACHINES` and `HOSTED_MACHINES`, each way). | Row | CPU clock | ticks per CPU cycle | before 2026-11-14 (from_rom) | | --- | --- | --- | --- | | NTSC (VCS, 7800) | 1,193,181.8 Hz | 0.0175999 | the same, to the bit | | PAL, SECAM (VCS, the #699 consoles, PAL 7800) | 1,182,298 Hz | 0.0177619 | 0.0175999: the music 0.92 % flat | (SECAM's clock is PAL's, HYPOTHESIS in `machine.py`; if a SECAM crystal shows otherwise, the oscillator still keeps its hertz and the row's new clock carries through.) A `Cartridge` built without `cpu_hz=` keeps the NTSC console's clock; `System(cartridge, machine)` takes the cartridge as built. The Supercharger takes a cassette input (`tape_level(t)`) and its BIOS as the player's own data, or loads the "fast" way ([claims.md](claims.md)). ## File formats and identification There is no header. A `.a26`/`.bin` file is the raw ROM image, and the scheme is identified by: 1. **MAME 0.285's software list** `hash/a2600.xml` (`$MAME_HASHPATH`, else the copy `fetch_references.py` pins under `reference/src/mame/`) (SHA-1, else CRC + size): ``, with RAM data areas for Super Chip. Read at runtime; never committed. It covers 772 of the 895 local dumps. 2. **Stella's verdict**, from the pinned Stella binary run with `-rominfo` (its database, else its size-and-signature detection; the census marks which). Stella is GPL-2.0+, so its detection is used as a program's output, never ported, and its database is not read (the row counts first written here came from reading its source tree's database file: struck, [provenance.md](provenance.md)). As `-rominfo` prints it, the scheme of all but one local dump is Stella's own detection, not a database entry (OBSERVED). 3. **A filename extension override**, as Stella accepts (`.f8`, `.e0`, …), for homebrew and test ROMs. The board itself (no Stella at run time) needs its own detector for files MAME's list does not carry: size first, then hotspot and signature tests written from Horton's `sizes.txt` and the scheme descriptions, checked against Stella's verdicts over the local sets (the census records both). The two sources agree on **771 of 772** comparable dumps (2K and 4K treated as one family, F8SW as F8, MAME's `a26_dc` as Stella's F0 "Dynacom Megaboy"). The one disagreement is Hobo (USA) (Proto), 8 KB: MAME has no slot feature and falls back to its size default F8; Stella detects UA. MAME also marks the entry `supported="no"`, which fits it being wrong. Override order: an explicit user choice, then MAME's slot feature, then the board's detector; disagreements logged. ## Measured coverage (scripts/count_bankswitch.py, 2026-10-21) Over the local No-Intro sets (found through `NO_INTRO_DIR`: one set of 897 zips and one of 697 7z), read in place: **895 distinct dumps** by SHA-1 (712 licensed, 127 prototypes, 16 unlicensed, 40 aftermarket). The "Kid Vid Voice Module (Audio Tapes)" zip holds only WAVs. | Scheme | All | Licensed | Size | Extra hardware | | --- | ---: | ---: | --- | --- | | 4K (and 2K mirrored) | 490 + 91 | 401 + 78 | 2/4 KB | none | | F8 | 174 | 120 | 8 KB | hotspots $1FF8–$1FF9 | | F6 | 45 | 39 | 16 KB | $1FF6–$1FF9 | | F6SC | 20 | 17 | 16 KB | Super Chip 128 B RAM | | AR (Supercharger) | 17 | 14 | 8,448 B per load | 6 KB RAM, 2 KB BIOS, tape | | E0 (Parker Bros.) | 16 | 14 | 8 KB | four 1 KB slices | | 3F (Tigervision) | 7 | 7 | 8 KB | write to $00–$3F | | FE (Activision) | 5 | 4 | 8 KB | stack-snooping | | E7 (M-Network) | 4 | 4 | 16 KB (one 12 KB) | 2 KB RAM | | F8SC | 4 | 3 | 8 KB | Super Chip | | UA | 4 | 0 | 8 KB | $0220/$0240 | | FA (CBS RAM+) | 4 | 3 | 12 KB | 256 B RAM | | F4 / F4SC | 3 / 3 | 0 / 3 | 32 KB | (Super Chip) | | FC | 2 | 0 | 4/8 KB | | | CV (CommaVid) | 2 | 2 | 2 KB | 1 KB RAM | | 32IN1, DPC, F0, WDSW | 1 each | 1, 1, 1, 0 | | DPC chip (Pitfall II) | **Schemes needed** (counting 2K and 4K as two): | Group | Dumps | 80 % | 90 % | 95 % | 99 % | 100 % | | --- | ---: | ---: | ---: | ---: | ---: | ---: | | All | 895 | 3 | 5 | 7 | 15 | 21 | | Licensed | 712 | 3 (4K, F8, 2K) | 5 (+F6, F6SC) | 7 (+AR, E0) | 13 | 17 | | Prototypes | 127 | 3 | 6 | 8 | 12 | 13 | | Unlicensed + aftermarket | 56 | 2 | 3 | 4 | 5 | 5 | So **2K, 4K, F8, F6 and Super Chip cover 92 % of licensed dumps**, E0 and the Supercharger take it past 95 %, and 3F, FE, E7, F8SC, F4SC and FA past 99 %. The local sets contain **no** DPC+, CDF, BUS or other ARM ("Harmony") schemes, and no 3E, EF, BF or DF: homebrew here is plain 4K/F8/F6/F4. ARM schemes are out of scope; they would make this a board with an ARM7 core (arm7tdmi-python exists in the family). Sizes in the set: 2 KB 93, 4 KB 491, 8 KB 212, 12 KB 5, 16 KB 67, 32 KB 6, 64 KB 2, and the odd ones: 8,448 / 16,896 / 25,344 / 33,792 bytes (Supercharger loads, multi-load images), 10,495 (Pitfall II: 8 KB program + 2 KB graphics + 255 bytes of the DPC's tables) and 8,195 (WDSW). ### Titles that need more than ROM - **Supercharger (17)**: Communist Mutants from Space (4), Dragonstomper, Escape from the Mindmaster, Fireball, Going-Up (Proto), Killer Satellites, Official Frogger, Party Mix, Phaser Patrol, Rabbit Transit, Suicide Mission, Survival Island, Sweat! (Proto), Sword of Saros. **MAME refuses all of them as cartridge files** (BSD-3 `vcs_slot.cpp:208-224` at mame0285, length check); it runs the Supercharger only as `a26_ss` with its BIOS and a cassette from `a2600_cass.xml`, so MAME is no detector for AR images loaded as files. - **DPC (1)**: Pitfall II. - **Super Chip (27)**, **CBS RAM+ (4)**: Mountain King, Omega Race, Tunnel Runner, Wings (Proto); **M-Network E7 (4)**: Bump 'n' Jump, BurgerTime (2), Masters of the Universe; **CommaVid (2)**: MagiCard, Video Life. ### Controllers (`stella -rominfo`) | Controller | Dumps | | --- | ---: | | Joystick | 841 | | Paddles | 61 | | Keypad (Keyboard Controller / Kid's Controller) | 30 | | SaveKey (homebrew, I²C EEPROM on a port) | 18 | | Driving controller | 2 (Indy 500) | | Kid Vid, MindLink, light gun | 2 each | | Booster Grip | 1 (Omega Race) | | Trak-Ball | 0 | Stella's `-rominfo` calls Activision Decathlon a paddle game (OBSERVED): a false positive the board must not copy. ### TV format NTSC 601, PAL 254, PAL60 5, SECAM 1, NTSC50 1, unknown 33 (mostly "(World)" homebrew and "(USA, Europe)" multi-region dumps). The name and MAME's compatibility feature disagree on five (Air Raid, Bobby Is Going Home, Crackpots, Meltdown (Proto), Zoo Fun: MAME says PAL). Some games flicker objects on alternate frames and expect the eye to blend them (the per-dump count first written here came from Stella's database file: struck). Phosphor blending is a frontend option, never a board behaviour. ## Per-scheme table and judges No hardware-tier judge exists for any scheme beyond "the game runs": the schemes are simple address decoders, specified by Horton's notes and the cartridge PCBs (some traced on AtariAge). The claim for each is therefore "specification + the game runs to its attract mode and in play, frame-compared with Stella (detector)". The exceptions worth a real test: | Scheme | Behaviour to get right | Check | | --- | --- | --- | | F8/F6/F4 | hotspot on dummy reads; power-on bank (hardware is random: HYPOTHESIS, no document states it; games are written to start from any bank and switch from the reset vector) | indexed-read probe ROM written in milestone 5; game boot from every start bank | | SC | read from the write window writes the bus value | probe ROM | | FE | bank from D5 of the cycle after the $01FE access; reset's own stack reads switch banks ([timing.md](timing.md)) | Decathlon, Robot Tank boot from defined bank | | 3F | writes below $40 also reach the TIA (both see them) | Miner 2049er | | E0 | last slice fixed | Montezuma's Revenge | | AR | write sequence (a read of $F0xx latches, the write is the fifth distinct address later), RAM write-protect bit, BIOS load from tape or the "fast load" shortcut used by every emulator | Stella detector; MAME `a26_ss` with cassette as a second | | DPC | fetchers, music mode on its own oscillator, the RNG, the 255-byte tables | Pitfall II, frame + audio vs Stella |