# Handoff: build `intellivision-python`, the Mattel Intellivision Master Component board ## Context you are inheriting The family's shape: **chips are cores, boards compose cores; never copy a chip file between repositories; extract on the second consumer**. Each core is certified on its own and pinned by the boards that use it; boards are validated against hardware-tier evidence, with emulators as detectors only. Add-ons are separate boards that plug into documented sockets on the base board. This board embeds two family cores: - **`cp1610-python`** (`/data/emu/cp1610-python`): the CP1610 CPU, Phase 0 running in parallel (its docs: `interrupts-and-bus.md`, `timing.md`, `undocumented-behavior.md`). Its proposed contract and this board's needs were reconciled point by point in [bus.md](bus.md); one disagreement (INTRM level vs edge) is resolved in favour of the core (open decision 4). - **`ay8910-python`** (`/data/emu/ay8910-python`, public): the AY-3-891x PSG. It has no AY-3-8914 yet; [psg.md](psg.md) lists the eight changes it needs (open decision 6). Read, in order, before writing code: 1. [README.md](../README.md), then [start-here.md](start-here.md): the machine, clocks, module shape. 2. [bus.md](bus.md): the bus phases, the bridge, the frame's timing, the import boundary and contract. 3. [stic.md](stic.md), [psg.md](psg.md), [memory-map.md](memory-map.md). 4. [cartridge.md](cartridge.md) (formats, census, BIOS), [addons.md](addons.md) (sockets, Intellivoice, ECS, machine rows). 5. [validation.md](validation.md): every oracle with tier and pin, and what is left as a judge. 6. [mame-oracle.md](mame-oracle.md): the recipe that ran, and why MAME says nothing about timing. Then `python3 -I scripts/fetch_references.py --verify` (65 files, 4 repositories; drop `--verify` to fetch what is missing: about 280 MB: 180 MB of documents, the largest the 1980 GI catalogue, the Intellivoice documentation and the 8914 die photograph, and 100 MB of source trees). ## Decided - **Scope** (task text): the Master Component board, package `intellivision`: CP1610 from the sibling core, AY-3-8900 STIC in the board, AY-3-8914 sound and I/O, EXEC/GROM/GRAM, RAM, hand controllers, cartridge maps; Intellivoice, ECS, Intellivision II, Sears and Tandyvision as rows or later add-ons; the Keyboard Component out of scope. - **Family rules**: Python floor 3.11 and PyPy must work; modern forms; reference boards are correct, not fast; BIOS and cartridges bring-your-own, read in place, never committed; local git, never pushed in Phase 0. ## Proposed names | Thing | Name | | --- | --- | | Repository, package | `intellivision-python`, `intellivision` (open decision 1) | | Board | `Intellivision` (one instance = one console; machine row as a constructor argument) | | Chips in the board | `STIC` (AY-3-8900/-1), `SystemRAM` (RA-3-9600: BACKTAB, the bridge, the 20-word FIFO, the address counter), `ScratchpadRAM`, `ExecROM` (RO-3-9502 + 9504: answers IAB), `GraphicsMemory` (GROM + GRAM, two address views) | | Devices on sockets | `Cartridge` (map + socket), `HandController` | | Machine rows | `intv` (NTSC Model 2609, default), `sears`, `intv2`, `pal` | | Timing modes | `console` (the default: [hw26] family F, the stealing on) and `mame` (no stealing, MAME's 14,934.68-cycle frame, for lockstep) | ## The import boundary and sockets The table and the 13-point contract are in [bus.md](bus.md) ("The import boundary", "The contract with the core, reconciled"). In one line: the core owns registers, decode, the per-microcycle phase sequence, request sampling and BUSAK; the board owns time, every address latch, the vectors, widths, INTAK's effect, the STIC's requests and every device. The PSG is `ay8910-python`'s `PSG(AY8914)`, ticked twice per microcycle. Sockets ([addons.md](addons.md)): `cartridge` (every phase, the latched address, the four loops SR1/INTRM, SR2/BUSRQ, BUSAK/SST and bus control; INTR, RESET, MCLK), `audio_in` (the cartridge AUDIO pin), `controller_left`, `controller_right`. Pass-through add-ons implement the same socket on their far side. **The gate**: with an empty socket chain the base board's lockstep and timing results are byte-for-byte what they were when the base was tagged; an add-on's first act is to rerun them. ## Milestones, the judge for each | # | Milestone | Judge | Exit | | --- | --- | --- | --- | | **M1** | Bus, latches, Scratchpad and System RAM, EXEC and GROM, IAB vectors, the STIC as a register file and an INTRM source, timing mode `mame` | MAME's instruction stream (detector, independent CPU code) | Astrosmash plus two more titles lockstep with `scripts/mame_trace.py` traces to their title screens: **0 unexplained** register or flag differences; cycle differences named against the core's known MAME faults | | **M2** | STIC background: Color Stack, Colored Squares, Foreground/Background, border, delays, border extension, the display handshake and register window, read-back (open `$3FF0`-style masks, closed `$0000`) | GI 1980 (structure), jzIntv `stic.txt`, wiki (tier 3); MAME and jzIntv pictures (detectors) at **4-bit colour numbers** | ten titles' title screens equal to MAME's at colour numbers, or each difference named with the tier-3 statement that decides it | | **M3** | MOBs: sizes, flips, priority, the 8 collision registers | `collision_notes.txt` (tier 3 by provenance); jzIntv `mob_test` (needs `as1600`) | `mob_test`'s screens and collision values as its source describes; MOB-heavy titles equal to two detectors or named | | **M4** | **Bus-steal timing**, timing mode `console`: the frame request, 12 row requests, the 2-NACT exit, the windows, FIFO replay on a late BUSAK, the System RAM's bus copy | **HW26's console results** (tier 3): its ten cartridges built from `sim/testroms/hw/*.asm` with its MIT assembler, run here | `hw_steal` OFF/ON **33431 / 30280**; `hw_intlate` **1C 1B 1B 1B 1B 1B**; `hw_rowcopy` **min(19, 24 - step)** at every step; `hw_frame2` V, W, U rows and **14934 / 15**; `hw_steal2`, `hw_grant`, `hw_grantx` within HW26's own residuals (TIMING_FIT "Residuals of F") | | **M5** | Sound: `PSG(AY8914)` from ay8910-python once it has the variant; the audio sum with `audio_in` | ay8910-python's 8910 die model for the engine; GI 1978 for the 8914 differences; MAME's register logs (detector) | register-write logs equal to MAME's on HW26's eight games (Buzz Bombers, Atlantis, Demon Attack, Shark! Shark!, B-17 Bomber, Dig Dug, Astrosmash, Night Stalker), with MAME's write-time quirks (HW26 PSG_NOTES P2, P3) explained | | **M6** | Hand controllers on the PSG ports, both sides, the 16-direction disc, multiple keys | MAME `handctrl.cpp` tables and the wiki (agree) | every code of [psg.md](psg.md) read back through `$01FE/$01FF` by a test program; three games playable with scripted input to a named screen | | **M7** | Cartridge maps: raw + `.cfg`, Intellicart `.rom`, a hash table generated from MAME's CC0 lists and this census, on-cartridge RAM, ECS-style paging | Mattel's cartridge standards (tier 2) for the common shapes; two detectors agreeing for the rest | all 209 No-Intro images map; the census's disagreement rows (C5 and the list in cartridge.md) each decided by running the image | | **M8** | Whole machine: MTE-201 (six versions) and the IMI test cartridge; then a curated smoke list; then the 209-image sweep (only when the board might be ready) | Mattel's own diagnostics (they pass on a good console) | every test screen reports a pass (what each test checks recorded as U15 is closed); sweep rows recorded, failures become the next smoke list | | **M9** | Machine rows `sears`, `intv2` (EXEC extension `$0400-$04FF`, RA-3-9600A, the cartridge check), `pal` (provisional) | the dumps themselves; MAME `intvsrs`, `intv2` traces | each row boots its EXEC to the same title screens as MAME; the Intellivision II cartridge check located and described (U9); PAL labelled provisional (U1) | | **M10+** | Add-on boards: Intellivoice (SPB640 + SP0256), ECS (PSG #2, ROM banks, RAM, UART, keyboards), JLP | GI SP0256 spec; HW26's console recordings (10 kHz); jzIntv `ecs.html` | separate repositories, each rerunning the base gate first | A milestone is closed when its exit holds and its undecidable items are written as "provisional, tier N". ## Unknowns (U) | # | Unknown | Best source / tier | Status | | --- | --- | --- | --- | | U1 | PAL: lines per frame, microcycles per line (57 gives 56 Hz at 312 lines; 64 fits 50 Hz), the windows | jzIntv's figures are marked guesses (tier 5); [hw26] DESIGN: "make every line/frame constant a region parameter" | undecidable here; provisional row | | U2 | SECAM consoles: STIC part, colour encoder, clocks | nothing in hand | not planned | | U3 | STIC registers "lose their state after a few frames" without INTAK: how | jzIntv `interrupts.txt` (tier 3), no mechanism | not modelled; logged | | U4 | Bits 14-15 and unimplemented bits on GROM/GRAM reads through the bridge | the console's `$2C` reads (`$3FF1` open, `$0000` closed) cover the STIC only | follow the STIC's rule, provisional | | U5 | The STIC's internal schedule: MOB pattern fetches, when registers and delays are sampled, when a collision bit appears | none | provisional, tier 5 | | U6 | Where inside a row request the row is copied; the release vs the 2 exit NACTs | not observable from the CPU ([hw26] TIMING_FIT) | F's choice (copy at request + 50), labelled | | U7 | What the System RAM does on ADAR (direct-mode instructions run from `$0200-$035F` "do not work correctly") | wiki (tier 3), no description | log and refuse to guess; a named fault state | | U8 | Whether the AY-3-8914's tone, noise, envelope, period-0 and DAC equal the AY-3-8910 die's | the 8914 die photograph (pinned, not traced) | the 8910 engine on trust | | U9 | The Intellivision II cartridge check: what it reads and why some Coleco and Mattel titles fail | the `intv2` EXEC (MAME runs 81 addresses in `$0400-$04FF`, first `$04B5` at cycle 15,472) | disassemble at M9 | | U10 | Maps of the 20 No-Intro images in no database and the 6 aftermarket raw images with no map | running them | M7 | | U11 | GSWD/RSWD interruptibility (core C14: manuals yes, jzIntv no) as the board sees it in bus grants | no console probe exists | the core's default (interruptible); a switch | | U12 | What makes GI's 14th SR2 ("thirteen or fourteen ... depending on picture offset") | the console fits 13 at every delay tried | not modelled | | U13 | Border colour: live per pixel (HW26 RTL) or latched per frame (MAME); the colour of a display-disabled frame (border vs black) | [hw26] STIC_NOTES D17, D7: tests proposed, no result | the live register and the border colour, provisional | | U14 | The EXEC with no cartridge: do the STIC aliases make it flash at ~2.3 s and ~5.8 s ([hw26] D18 prediction) | none | follow jzIntv's aliases | | U15 | What MTE-201 and the IMI cartridge test and what their pass screens look like | the cartridges themselves | read at M8 | | U16 | Does SR1 stay low 3,790 microcycles whatever the CPU does (MAME, [hw26]) or end at INTAK (jzIntv)? | indistinguishable with the core's edge rule except through the cartridge's INTRM loop | hold to 3,790 | | U17 | AY-3-8916/8917 read-back ("inaccessible bits mirror one of the I/O ports, needs further testing") | MAME notes | for the ECS and late `intv2` | | U18 | Python speed: one core callback per microcycle is 894,886 calls a second at real time | not measured | measure at M2; reference boards are correct, not fast | ## Contradictions between sources (C) | # | Contradiction | Sides | Decision | | --- | --- | --- | --- | | C1 | End of the STIC register window (display on) | jzIntv docs ~2,000; jzIntv source and wiki 2,900; console **3,791** | **3,791** ([hw26] `hw_frame2`, fit F) | | C2 | End of the GROM/GRAM window | jzIntv docs 3,780-3,790; jzIntv source 3,796; MAME 3,790; console fit: the frame request granted from 3,792 | F (3,792), the first BUSAK | | C3 | The extra bus requests | jzIntv docs: a 13th row request (57) at vertical delay 0; jzIntv source: also a short first request (44/57); MAME: a 42-microcycle frame request + 110 at delay 0; console: **a 100-microcycle frame request (3,792-3,891), 12 rows, no 13th** | console | | C4 | PSG port direction bits | GI 1978: bit 6 = port A, bit 7 = port B; jzIntv `psg.txt` the reverse | GI (MAME and [hw26] agree) | | C5 | USCF Chess / Land Battle cartridge RAM | MAME `$D000` + `$800`; FreeIntv `$D000-$D3FF` | run them at M7 | | C6 | Row request length | jzIntv docs and wiki 114 ("a minimum of 60" needed); jzIntv `MUST_BUSAK_TIME` 68; MAME 110; console fit **107 + 2 exit NACTs** from 3,926 + 912 *n* | console fit | | C7 | PSG period 0 | AY-3-8910 die and MAME: as 1; the wiki's PSG page: 4,096 (tone), `$20000` (envelope) | the die's rule (8910 on trust, U8) | | C8 | AY-3-891x chip-select nibble | MAME notes: A7-A4 = 0000 on the Intellivision's 8914, 1111 on the ECS's 8917; but both answer at `$x1F0`/`$x0F0` (bits 7-4 = 1111) | the board decodes ranges itself; the core's rule is the core's question | | C9 | 8914 envelope-shape register read-back | MAME (hardware-tested masks): 4 bits; wiki: write-only, reads 0 | MAME (a test claim beats a table) | | C10 | A read of a closed STIC register | MAME: the address offset; console: `$0000` | console | | C11 | Intellivoice sample rate | MAME 9,285 Hz; console recordings 9,950-10,500, 3.12 MHz / 312 = 10 kHz | 10 kHz | | C12 | INTRM: level or edge | this board's first draft: level; the core: edge, dropped on release | edge (open decision 4) | | C13 | GRAM range | jzIntv `memory_map.txt` `$3800-$3AFF`; 64 cards x 8 bytes = `$3800-$39FF`, mirrored | 512 bytes, mirrored to `$3FFF` | | C14 | The CPU's bus grant rule | G82 and the core: only after interruptible instructions; the MAME fork HW26 tried: after any instruction | G82 (console `hw_grant`) | ## Open decisions for Aubrey **Decided by Aubrey on 2026-11-12** (recorded after a walk through all fourteen Phase 0 briefs): - The Python package is `intellivision_python` (family rule set the same day: a repository `x-python` always imports as `x_python`); read any other package name in these documents as that. - Decision 4 (INTRM edge), 5 (the ten console cartridges as M4's judge) and 8 (`console` and `mame` timing modes): **confirmed**. - Decision 6: the AY-3-8914 variant in ay8910-python is **approved** as an issue on that core, which is recertified after the engine change. - Referees built from die-derived material are built just before the rung that needs them, not up front. - Outside contacts proposed below are **deferred until the core or board exists**; Aubrey sends them himself, from a draft. - Remote: local through Phase 0; after the first passing rung or milestone, a private GitHub remote. Where a recommendation below names a different point, this replaces it. - Every other recommendation below is **accepted as written** unless a line here says otherwise. 1. **Package name.** The task text says package `intellivision`; recent family members use `_python` (`pcengine_python`, `ay8910_python`), while the CPU core proposes `cp1610`. *Recommend* `intellivision` as given, unless you want the `_python` suffix family-wide. 2. **Scope and order.** NTSC Model 2609 first; `sears` and `intv2` rows at M9; `pal` as a provisional row (U1); SECAM and INTV88/TutorVision not planned. *Recommend* as stated. 3. **`sp0256-python` as a chip core.** The SP0256 has 31 users in MAME 0.285 (home-computer speech boards for the BBC, Spectrum, CPC, CoCo, C64, MSX, Odyssey2's *The Voice*; Tecfri arcade boards; two pinball machines), so by the chip rule it qualifies the moment a second family board could use it; none is planned today. *Recommend* building it as its own core when the Intellivoice add-on starts (M10), not inside the Intellivoice board, since an extraction later would be a move of the same code; its resident ROMs (-012 here, AL2 elsewhere) are data. 4. **INTRM as an edge.** The core proposes `INTRM_EDGE = True` (falling edge sets a request; taking it or the line rising clears it); this board's first draft asked for a level. The console's SR1 stays low ~3,790 microcycles, so a level would re-enter the interrupt routine. *Recommend* the edge rule, with the board holding SR1 for the whole window as MAME and HW26 do. 5. **HW26's console results as the timing judge.** Miasmark's `openFPGA-Intellivision` (MIT) published ten timing cartridges and the counts one console showed. *Recommend* making them M4's exit test: fetch the pinned repository, assemble its `.asm` sources with its MIT `tools/as1610.py` (run as a tool, never copied), run them on this board, and treat family F's parameters as the starting point and the screens as the judge. Say plainly in the claims that this is one console read off a screen. 6. **`AY8914` in ay8910-python.** Raise the eight changes of [psg.md](psg.md) on that core (an issue or PR from its own session), including the one engine change (two envelope-select bits shifting the envelope). *Recommend* yes, before M5; the 8914's engine stays "the 8910's on trust" until someone traces the pinned die photograph (U8), which *I recommend* only if a sound difference ever needs it. 7. **The STIC stays in the board.** No second consumer exists (all six MAME users are Intellivisions; the Unisonic Champion uses a different GI chip). *Recommend* yes, as an instance-based package so an INTV88 row could be added. 8. **Two timing modes.** `console` (default, stealing on) and `mame` (no stealing, MAME's frame) so the board can lockstep with MAME at all. *Recommend* yes; HW26's model does the same. 9. **jzIntv and `as1600`.** Building jzIntv (GPL) as a black-box detector and `as1600` to assemble its `examples/` (`mob_test`, `mem_test_ra39600`, ...). *Recommend* deferring to M3, when `mob_test` is wanted; HW26's assembler covers M4. 10. **Bus fights** (no BUSAK at the top of the frame, ADAR from System RAM): *recommend* named, deterministic fault states that are logged, never guessed pictures. 11. **Remote.** *Recommend* local until M1 passes, then a private GitHub remote (the family's "remotes as needed" rule).