# The bus: phases, the two buses, the bridge, and who owns what This is the part of the Intellivision that decides the design. Sources, with tiers ([validation.md](validation.md)): - **[gi80]** GI Microelectronics Data Catalog 1980, pages 5-9 to 5-22 (PDF pages 189-203): the GIMINI 8900 set, AY-3-8900/8900-1, RO-3-9502, RO-3-9503, RA-3-9600, RO-3-9504 (tier 2). - **[gi78]** GI catalogue 1978, section 7, pages 86-98 and 106-109: CP1610 signals and state flow, the RO-3-950x ROMs, the 8900 system (tier 2). - **[conn78]** GI drawing 39-149, *Mattel Cartridge Connector*, 1978-09-26; **[parts78]** *Mattel Video Game System Parts List*, 1978-09-12 (Chandler papers; tier 2). - **[jz-master]** Joe Zbiciak, *Intellivision Master Component Hardware* (`doc/tech/master.html` in the jzIntv source) and `doc/programming/interrupts.txt`: bus transactions and timing numbers **measured on an NTSC console** (tier 3). - **[jz-src]** jzIntv's GPL source, read in Phase 0 before the 2026-11-14 rule (tier 5 code holding tier 3 numbers, some credited to Kevin Horton). Every [jz-src] value is HYPOTHESIS (for review) until re-observed on a shipped jzIntv build; the source is not fetched since 2026-11-24 (Aubrey). - **[hw26]** Miasmark `openFPGA-Intellivision` @ `577805cd`, `docs/HW_TESTS.md` and `docs/TIMING_FIT.md`: ten timing cartridges run on one NTSC Model 2609 on 2026-10-31 and 2026-11-01, results read off the screen (tier 3), and a model fitted to them ("family F"; the fit itself is a tier-5 inference). - **[core]** `../cp1610-python` docs at its Phase 0 (`docs/interrupts-and-bus.md`, `timing.md`, `undocumented-behavior.md`), which cite S1 (GI CP-1600 Users Manual 1975) and G82 (CP1600/CP1610 Data Manual 1982). - **[wiki]** Intellivision Wiki pages *System RAM*, *STIC* (tier 3). ## One CPU microcycle is one bus phase The CP1610 has one 16-bit bus for both addresses and data, and three control outputs that name what the bus is doing in the current microcycle [gi78 p.87 and p.105 Fig. 7, jz-master, core]: | BDIR BC2 BC1 | Name | Who drives DB0-15 | Meaning | | --- | --- | --- | --- | | 0 0 0 | NACT | nobody | no action; the bus floats | | 0 0 1 | ADAR | the addressed device | its data **is latched by every device as the next address** (direct addressing) | | 0 1 0 | IAB | a device (the EXEC ROM) | the reset or interrupt vector | | 0 1 1 | DTB | the addressed device | data to the CPU (a read) | | 1 0 0 | BAR | the CPU | an address; every device latches and decodes it | | 1 0 1 | DW | the CPU | write data, first cycle | | 1 1 0 | DWS | the CPU | write data, strobe cycle (always follows DW) | | 1 1 1 | INTAK | the CPU | the stack pointer as an address, at the start of interrupt service | (GI's own tables list the columns as BDIR BC1 BC2; the codes are the same.) Transactions [jz-master, core `timing.md`]: read = `BAR NACT DTB NACT`; write = `BAR NACT DW DWS NACT`; direct read = `BAR NACT ADAR NACT DTB NACT`; direct write = `BAR NACT ADAR NACT DW DWS NACT`; interrupt = `INTAK NACT DW DWS NACT IAB NACT NACT NACT` (9 microcycles [core, S1 p.35]); reset = `NACT IAB NACT NACT NACT` then the first BAR [core, S1 p.27, O81]. Consequences the board depends on: 1. **Devices hold the address, the CPU does not present it with the data.** Every device has its own address latch, loaded on BAR, INTAK and ADAR (the AY-3-8914's sheet draws both BAR and ADAR as "address bus timing" [gi78 p.103]). The board models one latch per bus (they all hold the same value) and decodes on the data phase. 2. **ADAR is a read whose result nobody sends to the CPU.** The addressed device puts a word on the bus and all devices latch it as the address. A 10-bit ROM supplies a short word: the RO-3-9502 "will output the 10 bits of addressed data and also drive a logic zero on the top six bits of the bus" [gi80 5-13], so a direct address held in 10-bit ROM cannot exceed `$03FF`; cartridges use SDBD for 16-bit constants. **The System RAM does not implement ADAR correctly**: direct-mode instructions executed from `$0200-$035F` misbehave [wiki System RAM]. What it does instead is unknown (U7). 3. **IAB is answered by a ROM.** The RO-3-9502 holds a programmable start vector and a second, interrupt, vector, and returns the first on the IAB after MCLR and the second on every later IAB [gi80 5-13]. On this machine: `$1000` and `$1004` [jz-master; MAME trace: first instruction at `$1000`, interrupt entry at `$1004`]. The core asks the board; it does not know them. 4. **INTAK is special to exactly one chip.** The RA-3-9600 "tests for the INTAK response from the CPU and uses this signal as an entry control for a copy mode between the two buses" [gi80 5-18]; jz-master says discrete logic turns INTAK into BAR for the other devices. The cartridge port carries the bus-control lines out and back in (below), so what a cartridge sees is the board's business. ## Clocks | Clock | NTSC | PAL | Source | | --- | --- | --- | --- | | master (crystal, STIC clock, cartridge pin MCLK) | 3,579,545 Hz | 4,000,000 Hz | [gi80 5-10]; the parts list's crystal is "3.579MHz" [parts78] | | CPU clock phi1/phi2 and PSG clock | master / 2 = 1,789,772.5 Hz | 2,000,000 Hz | [gi80 5-19 "1.79545 MHz" (sic)], [jz psg.txt] | | CPU microcycle (one bus phase) | master / 4 = 894,886.25 Hz | 1,000,000 Hz | [jz-master; core: one microcycle = two clock periods] | | one STIC pixel | 1 master clock (279.4 ns) | | the Model 2609 Service Manual p.60 gives 280 ns, as transcribed by [hw26] `DESIGN.md` (the manual itself is **not pinned**: no stable copy found); agrees with 57 microcycles = 228 master clocks a line | | frame | 262 lines x 57 microcycles = 14,934 microcycles, 59.92 Hz | 312 lines x 64 = 19,968 (**estimate**) | [jz-master]; **console-measured** 14,934 by [hw26] `hw_frame2`; PAL from [jz-src], marked "a stab" there (U1) | **One timeline in master clocks, owned by the board.** A microcycle is 4 master clocks; the PSG gets 2 input clocks per microcycle; the STIC advances 4 pixels per microcycle. The board's unit of work is the microcycle, because that is the grain of every measured number below. ## Two buses and a bridge There is a second bus, 14 bits wide (SD0-SD13), owned by the STIC, with decoded strobes `BAR'`, `DTB'`, `DWS'`. On it sit the **Graphics ROM**, the **Graphics RAM** and the STIC's own registers. The CPU has no direct path to any of the three. The **System RAM chip (RA-3-9600)** is the bridge [gi80 5-18]: - **Mode 1, bus copy.** "On decoding an interrupt the RAM is enabled into a bus copy mode": it copies the low 14 bits of the CPU bus onto the graphics bus; on a CPU read of a graphics address it reverses and gates the 14-bit bus through to the CPU bus. The STIC decodes the CPU's BDIR/BC1/BC2 into `BAR'/DTB'/DWS'` only while the STIC itself is in CPU-controlled mode [gi80 5-10: "otherwise it is ignored"]. - **Mode 2, DMA.** "The end of the copy mode is controlled by the first BUSAK negative edge." BUSAK switches the RAM's address decoder from the CPU's latch to a **graphics address counter** (reset to 0 when the interrupt was decoded). While BUSAK is low, each of 20 SR3 pulses puts one BACKTAB word on the 14-bit bus, loads it into one of **20 shift registers**, and increments the counter; for the next 15 lines SR3 clocks the shift registers round without the CPU. "This sequence occurs for the 12 rows of characters until all 240 have been successfully accessed." So the visible windows are two different mechanisms: | Thing | Reachable by the CPU | Why | | --- | --- | --- | | STIC registers `$0000-$003F` | from the frame start until the STIC leaves CPU-controlled mode | the STIC stops decoding the CPU's control lines | | GROM `$3000-$37FF`, GRAM `$3800-$3FFF` | from INTAK until the first BUSAK | the System RAM stops copying the bus | | both, when the display is not enabled this frame | the whole frame | no BUSRQ is issued, so mode 1 never ends ([gi78 p.108] "an additional control code can extend the CPU time"; console: [hw26] `hw_frame2` reads `$2C` open mid-frame with the display off) | The Graphics ROM chip **moves in the memory map** with these signals [gi80 5-16]: after SR1 it sits at 12288-14335 (`$3000-$37FF`) with the external memory (GRAM) at 14336 up; after BUSAK it sits at 0-2047 with GRAM at 2048-4095, the STIC's own numbering of cards (GROM cards 0-255, then GRAM). It also decodes GRAM's enable and write strobes. The board models this as one "graphics memory" object with two address views, not as a ROM that relocates. ## The cartridge port is a loop, not a slot [conn78] GI's 1978 connector sheet lists, besides DB0-DB15 (the sheet says "10" leads; 16 are named), MSYNC, MCLK, CBLNK, RESET, INTR, AUDIO in, VIDEO in, +5 V and six grounds, four **signal pairs "looped through the ROM cartridge"**: bus control out (CP1610, 3 lines) / bus control in (3); SR1 out / INTRM in; SR2 out / BUSRQ in; BUSAK out / SST. A cartridge or a pass-through add-on (Intellivoice, ECS) therefore sits *between* the CPU's control lines and the console's devices, and between the STIC's requests and the CPU's request inputs. The board's cartridge socket must expose those four loops (default: wired straight through) and the AUDIO input, not only a memory interface. The Intellivoice manual lists BC1, BC2 and BDIR on its stacking connector for the same reason [Intellivoice documentation, section 4.5.4.2]. ## Bus requests and the interrupt: the frame (NTSC) Three witnesses, in microcycles from the start of the frame (SR1 falls, INTRM asserted). Only the last column was measured on a console with a published test program; the jzIntv column was measured by Zbiciak and Kyle Davis with non-interruptible code [jz-master] and the method is not published as a program. | Event | jzIntv documents [jz-master, interrupts.txt] | jzIntv source / MAME `stic.h` | console, [hw26] family F | | --- | --- | --- | --- | | STIC registers stop answering (frame with display on) | ~2,000 (memory_map.txt) | 2,900 (jz-src) | **3,791** (end of the register window) | | INTRM released | | 2,907 (jz-src, "from Kevin Horton"); 3,790 (MAME) | 3,790 (wiki "exactly 3,791") | | GROM/GRAM stop answering (first BUSAK) | 3,780-3,790 | 3,796 (jz-src) | 3,792 (the frame request's grant) | | frame request (first BUSRQ) | | 57 (jz-src); 42 (MAME) | **3,792-3,891, 100 microcycles**, separate from row 0's | | BUSRQ for card row *n* (0-11) | 3,933 + 114 x vertical_delay + 912 x *n* | 110 long (MAME) | from 3,926 + 912 *n* for 107, CPU resumes at 4,035 + 912 *n* | | extra row request when vertical_delay = 0 | 14,877-14,934 (57) | 44 (jz-src); +110 (MAME) | **none**: 12 row requests at any delay | | frame length available to the CPU, display off | 14,934 | | 14,934 frame; 14,487 left to a main loop after the EXEC's interrupt path | | stolen per frame, display on | ~1,416 (delay 0), ~1,362 (delay > 0) | | 1,365.7 on average, a 3-frame pattern (`hw_steal`) | 912 = 16 lines x 57; 114 = 2 lines x 57. **The console results decide C1, C2, C3 and C6 for the board** (see the brief): the register window ends at 3,791, there is no 13th row request, and the row request is 107 + 2 exit NACTs, not 110 or 114. GI's "SR2 is issued thirteen or fourteen times per picture frame depending on picture offset" [gi80 5-10] is then 12 rows + 1 frame request = 13; what makes a 14th is unknown (U12). Every console figure is relative to INTRM as the CPU sees it: the delay between SR1 and the CPU's sampling is folded into it (U9). The CPU grants the bus **only after an interruptible instruction** (G82 p.11, 2.5.5; console: [hw26] `hw_grant`, 15 probe loops, matched by that rule and not by "after any instruction" or a look-ahead rule). A run of non-interruptible instructions longer than the time left before the row is copied loses the row. **What a late or missing BUSAK does** (tier 3, [wiki System RAM], [jz-master]): - Late during active display: the System RAM does not advance its FIFO; the previous row of cards is shown again and the rest of the picture moves down a row. [hw26]'s model copies the row at request + 50 (3,976 + 912 *n*), a choice: where inside the request the copy happens is not observable from the CPU. - Missing at the top of the frame (a long run of non-interruptible instructions): the RAM stays in bus copy while the STIC drives the graphics bus; on a console the two fight. The board models "garbage" as a named, deterministic state and logs it; it is not hardware-decidable here. - **No INTAK for several frames** (interrupts left disabled): no bus copy, so no access to GRAM or GROM, and "STIC registers lose their state after a few frames" [jz interrupts.txt] (U3). **Display enable is a handshake, not a bit.** The picture is shown in a frame only if the CPU touched `$0020` during that frame's register window; otherwise the STIC shows the border colour and issues no BUSRQ [jz interrupts.txt]. On the console a `$20` write *after* the window does not close the registers or enable the display ([hw26] `hw_frame2`: a `$2C` read after a late write returns `$3FF1`). A read of a closed STIC register returns **`$0000`** on the console, not the address offset MAME returns. The mode register `$0021` is the same kind of strobe: a write selects Foreground/Background, a **read** selects Color Stack ([stic.md](stic.md)). **MAME is not a bus-timing detector.** `intv_m.cpp` calls `adjust_icount(-(12*ROW_BUSRQ+FRAME_BUSRQ))` from the interrupt callback, but that callback runs between CPU time slices, where `adjust_icount` has no effect ([hw26] STIC_NOTES T2). Checked here on our own MAME 0.285 trace of Astrosmash (2 s, 228,767 instructions): the largest gap between consecutive instructions' `totalcycles` is **21**, and interrupts come every 14,934 microcycles on average: MAME's CPU loses **no** cycles to the STIC. ## The import boundary | Owns | `cp1610-python` (the core) | this board | | --- | --- | --- | | Registers R0-R7, flags, I and D, decode of the 10-bit instruction set, SDBD, the interruptible rule | yes | | | The sequence of bus phases of every instruction, interrupt entry and reset, one per microcycle | yes | | | Sampling INTRM, INTR and BUSRQ; asserting BUSAK; TCI, HALT, EBCA outputs | yes | | | The cycle table (`timing = "doc" \| "console"`) | yes; this board selects `console` | | | Time (master clocks), what a microcycle costs | | yes | | Address latches, ADAR's "data becomes address", what each device answers on each phase | | yes | | The reset and interrupt vectors (IAB) | | yes (the EXEC ROM chip) | | 10-bit and 8-bit word widths, open bus, BDRDY tied ready, EBCI | | yes | | INTAK handling, bus copy, the windows | | yes (System RAM + STIC) | | When INTRM and BUSRQ are asserted and released | | yes (STIC) | | STIC, GROM, GRAM, System RAM, Scratchpad RAM, EXEC ROM, cartridge, controllers | | yes | | PSG | | no: `ay8910-python` ([psg.md](psg.md)) | ### The contract with the core, reconciled The core's Phase 0 (`cp1610-python`, its status page and `interrupts-and-bus.md`, read 2026-11-12) proposes: one callback per microcycle, `bus(phase, value) -> int`, phase one of NACT, BAR, ADAR, DTB, DW, DWS, INTAK, IAB; `value` the CPU's word in BAR/DW/DWS/INTAK; the return used in DTB and IAB; `step()` returns microcycles (= callbacks); plain attributes `intrm`, `intr`, `busrq` set by the board inside callbacks; `busak`, `halt` readable in callbacks; `ebci(n) -> bool`; optional `tci()` / `sin()` hooks; BDRDY and STPST later. Point by point against what this board needs: | # | Board's requirement | Core's proposal | State | | --- | --- | --- | --- | | 1 | One callback per microcycle with the phase, the CPU's word on BAR/DW/DWS/INTAK, the board's word returned on ADAR/IAB/DTB; NACTs reported; the clock is the callback count | the same | **agree** | | 2 | Direct addressing not folded: `BAR NACT ADAR NACT DTB` or `... DW DWS`; the board turns the ADAR word into the next address | "the CPU never drives a direct address: devices latch it in ADAR"; the board owns the latch | **agree** | | 3 | INTAK distinct from BAR; the DW/DWS after it push the PC like any write | the 9-cycle sequence above | **agree** | | 4 | IAB returns the vector on reset and on interrupt | `NACT IAB NACT NACT NACT BAR` after MSYNC (the first draft of this page said IAB was the first microcycle: corrected) | **agree** | | 5 | Full 16-bit bus both ways; the board returns 0 in the upper bits for 10-bit ROM and 8-bit devices; the core masks opcodes | the same; the core lists what bits 15-10 of an opcode do as its own unknown | **agree** | | 6 | Input pins as attributes set in callbacks: INTRM, BUSRQ, MSYNC; INTR (not driven by the console, but a cartridge pin [conn78]), BDRDY (tied ready), EBCI | `intrm`, `intr`, `busrq`, `ebci(n)`; BDRDY, STPST later | **agree**; MSYNC is a `reset()` call | | 7 | BUSAK and HALT readable in every callback | `busak`, `halt` attributes | **agree** | | 8 | While BUSAK is low the core keeps calling back, once per microcycle; latency from BUSRQ to BUSAK and from release to the next fetch stated with sources | BUSAK low from the first NACT after the granting instruction, no entry overhead; **two NACTs** after BUSRQ is seen high (S1 p.36, G82 Fig. 16) | **agree**; the console sees only release + exit together ([hw26] TIMING_FIT "not observable") | | 9 | INTRM and BUSRQ sampled only at the end of an interruptible instruction; a request withdrawn before then is lost | BUSRQ: a level, as asked. **INTRM: an edge** (falling edge sets a request; taking it or the line rising clears it; core C16, switch `INTRM_EDGE = True`) | **was a disagreement; the board adopts the core's edge rule.** The first draft asked for a pure level. On this console INTRM stays low for 3,790 microcycles, longer than an interrupt routine may run, so a level would re-enter the routine; jzIntv avoids that by dropping SR1 at INTAK instead. The console's `hw_frame2` row W (request made and released while masked: no interrupt) fits both. The board keeps INTRM low for the whole window, as MAME and [hw26]'s model do, and relies on the edge latch. Open decision 4 | | 10 | The interruptible rule is the core's, exposed read-only | the rule as in S1/G82; GSWD and RSWD interruptible by default (`GSWD_RSWD_INTERRUPTIBLE = True`), jzIntv says not (core C14) | **agree**; C14 is board-observable (a `hw_grant`-style probe with GSWD) and no console result decides it | | 11 | Deterministic power-up, independent instances (the Unisonic Champion 2711 is a second consumer) | the same | **agree** | | 12 | PyPy: fewer than 80 instance attributes on the hot object; `step()` runs one instruction; no per-microcycle generator | the same | **agree** | | 13 | The `console` cycle table: SDBD + `MVI@ R4,R7` 15, JSR (jump family) 13, `PULR R7` 12 ([hw26] `hw_frame2`, fit F) | `timing = "console"` adds one trailing NACT to exactly those cases; default `doc` | **agree**; the board passes `timing="console"`. Where the extra NACT sits inside the instruction is the core's U16 |