# Start here: the machine, the clocks, the module shape Read [README.md](../README.md) first, then this, then [bus.md](bus.md), [stic.md](stic.md), [psg.md](psg.md), [memory-map.md](memory-map.md), [cartridge.md](cartridge.md), [addons.md](addons.md), [validation.md](validation.md), [mame-oracle.md](mame-oracle.md), and last [handoff-brief.md](handoff-brief.md). Nothing here is code: this is Phase 0. ## The machine in one paragraph Mattel's Intellivision (1979-80) is General Instrument's GIMINI 8900 chip set: a **CP1610** 16-bit CPU with a multiplexed bus whose every microcycle is a named phase; the **AY-3-8900-1 STIC**, which draws 20 x 12 cards and 8 moving objects from its own 14-bit graphics bus, is the only time base and the only interrupt source, and **stops the CPU** for each row of cards; the **RA-3-9600 System RAM**, which holds the screen (BACKTAB) and bridges the CPU's bus to the STIC's only while the STIC allows; a 4K-word **Executive ROM** that every game runs through; a 2K-byte **Graphics ROM** of 256 cards and 512 bytes of **Graphics RAM**; and the **AY-3-8914** sound chip, whose two ports read the hand controllers. Three facts decide the design: devices latch addresses themselves (so the board, not the CPU, owns address decoding); the CPU can reach the STIC, GROM and GRAM only in windows at the top of a frame; and the STIC's row fetches take about 1,366 of the 14,934 microcycles of each frame from the CPU, at times a real console has been measured to show ([bus.md](bus.md)). ## The machines as data | | `intv` (Model 2609, NTSC) | `sears` | `intv2` | `pal` | | --- | --- | --- | --- | --- | | Master clock | 3,579,545 Hz | same | same | 4,000,000 Hz | | CPU clock / microcycle | master / 2 / master / 4 (894,886.25 Hz) | same | same | 2 MHz / 1 MHz | | STIC | AY-3-8900-1 | same | same | AY-3-8900 | | Frame | 262 lines x 57 = 14,934 microcycles, 59.92 Hz (console-measured) | same | same | unknown (U1) | | EXEC | exec.bin | Sears EXEC | 4,352 words, `$0400-$04FF` extension | exec.bin | | System RAM | RA-3-9600 | same | RA-3-9600A (`$0360-$03FF` garbage) | | | PSG | AY-3-8914 | same | AY-3-8914, or AY-3-8916 in later units | AY-3-8914 at 2 MHz | ## Time **One timeline in master clocks, owned by the board.** The unit of work is the CPU microcycle (4 master clocks): the core calls the board once per microcycle with the bus phase; the board advances the STIC by 4 pixels and the PSG by 2 input clocks, and sets INTRM and BUSRQ as the STIC's schedule says. Every measured number in the sources is in microcycles from the frame start. ## The module shape (proposed) ``` intellivision/ machine.py the machine table (rows above), timing mode (console | mame) board.py Intellivision: the bus callback, the address latch, the phase decode, the clock stic/ STIC (instance): registers, window, schedule (INTRM, BUSRQ), background, MOBs, collisions system_ram.py SystemRAM: BACKTAB, bus copy, the 20-word FIFO and address counter graphics.py GraphicsMemory: GROM + GRAM, the two address views rom.py ExecROM (IAB vectors), ScratchpadRAM cartridge/ maps (cfg, rom, hash table), paging, on-cart RAM, the socket and its loops controllers.py HandController codes sockets.py the Protocols for the cartridge chain, audio_in, the controller ports; test fakes system.py run_frame, the frame scheduler ``` with `cp1610-python` and `ay8910-python` pinned by git revision and nothing copied. No module state: two boards in one process must not share anything. The STIC sits behind an import-boundary test so an INTV88 row (or an extraction, if a second consumer ever appears) is a move, not a rewrite. ## Performance: correct, not fast A real-time Intellivision is 894,886 core callbacks a second, each one a Python call that decodes a phase and may touch the STIC, plus 1.79 M PSG ticks. Nothing was measured here. Expect a fraction of real time on PyPy and much less on CPython; that is acceptable for a reference board, whose milestones are judged by traces and counts. Watch the PyPy 80-attribute limit on the board and the STIC. ## Floors and rules Python floor 3.11 (the newest PyPy supports), ruff `py311`, modern forms. Never copy a chip file between repositories. BIOS files and cartridges are bring-your-own, read in place, never committed (the `.gitignore` refuses `.bin .int .rom .itv .luigi .zip .7z`). Local git until a milestone says otherwise.