# Start here: the CP1600 family as a core author needs it Everything here carries a source tag. The tags (full entries with pins in [validation.md](validation.md)): | Tag | Source | Tier | | --- | --- | --- | | **S1** | GI *CP-1600 Microprocessor Users Manual*, May 1975 (PDF page numbers) | 2 manufacturer | | **G82** | GI *CP1600/CP1610 Microprocessor Data Manual*, 1982 (PDF page = book page + 2) | 2 manufacturer | | **DS76/77/80/82** | the CP1600 and CP1610 data sheets in GI's 1976, 1977, 1980 and 1982 catalogs | 2 manufacturer | | **O81** | Osborne *16-Bit Microprocessor Handbook* (1981), chapter 2 | 2, a restatement of GI | | **wiki** | wiki.intellivision.us pages (CP1610, Bus Phases, opcode pages) | 3 community, hardware-informed | | **HW26** | Miasmark `openFPGA-Intellivision` `docs/CPU_NOTES.md`, `HW_TESTS.md`, `TIMING_FIT.md`: test cartridges run on one real console, 2026-10-31 and 2026-11-01 | 3 tests run on hardware | | **jz** | jzIntv 2020-07-12: its documents; its program a closed box (votes read from its source before 2026-11-14 are HYPOTHESIS; source not fetched since 2026-11-24) | 5 emulator; documents 3 where they say what was measured | | **MAME** | MAME 0.285 `cp1610.cpp` | 5 emulator | "U*n*" and "C*n*" point into [undocumented-behavior.md](undocumented-behavior.md). ## What the part is A 16-bit, single-chip NMOS microprocessor from General Instrument (1975), in a 40-pin package, with a **multiplexed 16-bit address/data bus** and three bus control outputs (BDIR, BC1, BC2) that name what the bus is doing in every microcycle. There are no separate address pins: the CPU puts an address on D0-D15 in one cycle (BAR) and external logic must latch it; data moves in a later cycle (DTB, DW/DWS). Devices keep their own address register. This is the fact the whole embedding contract follows from ([handoff-brief.md](handoff-brief.md)). Family members: the **CP1600** (3.3 MHz two-phase clock, 600 ns microcycle; G82 p.5), the **CP1600A** (5 MHz, 400 ns: DS76; S1 of 1975 quotes these figures for "the CP1600") and the **CP1610** (2 MHz, 1 µs, VDD +11 V where the CP1600 has +12 V: G82 p.5 and 5.2). The instruction set, the bus and the pins are the same; **only the clock limit and the supply differ**. One model serves all of them; the clock is the board's. A later **CP1610A** exists in the TutorVision / INTV88 board; J. Zbiciak's *TutorVision / INTV88 Reverse Engineering Notes* (2017-2018, a published Google document, not pinned) say no data sheet for it is available, and an AtariAge post calls it a pin-compatible silicon-gate redesign. Nothing in this family runs that board; the core does not model a CP1610A difference (none is documented). **One microcycle = two clock periods = four time slots TS1-TS4** (S1 p.17-18, "1 MICROCYCLE = 2 CLOCK CYCLES" DS76-82). Every cycle count in every source is in microcycles. ## Registers Eight 16-bit registers, all usable as accumulators (S1 p.14, p.48). | Register | Special role | | --- | --- | | R0 | none. Mode field 000 means *direct*, so R0 cannot be a pointer | | R1-R3 | pointers without side effects. R0-R3 are the only shiftable registers and the only GSWD targets | | R4, R5 | pointers that **post-increment** on every indirect access. JSR may save the return address in them | | R6 | stack pointer: **post-increment on write, pre-decrement on read**; the stack grows upward. Used by the interrupt sequence | | R7 | program counter. Immediate mode is "indirect through R7" (mode 111), and R7 as a destination is a jump | Status: **S** (sign), **Z** (zero), **OV** (overflow), **C** (carry), plus two internal flip-flops that no instruction reads: the interrupt enable (INTFF, "I") and the double-byte-data latch ("D"). There is no status register in memory: GSWD copies S Z OV C into bits 7-4 **and** 15-12 of R0-R3 (other bits 0), RSWD loads them from bits 7-4 of any register (S1 p.56). An interrupt saves only the PC; the service routine saves the flags itself with GSWD. At reset all registers and flags are undefined (S1 p.21); the interrupt system is disabled by MSYNC (S1 p.11). ## Instruction words An opcode is the **low 10 bits** of a 16-bit word; bits 15-10 are "not implemented by the microcontrol logic" (S1 p.42) so a 10-bit ROM can hold programs (a 10-bit word is a *decle*). Data operands, direct addresses and branch displacements use whatever width the memory has, up to 16 bits. The jump's two address words use 6 and 10 bits. What the chip does with nonzero bits 15-10 in an opcode word is U1. The 1,024 opcodes by range (S1 p.42-58, G82 p.33-37; the ranges agree with the wiki table, whose errors on single pages are listed in C17): | Range | Words | Instruction | Flags | Notes | | --- | --- | --- | --- | --- | | `000` | 1 | HLT | - | see [interrupts-and-bus.md](interrupts-and-bus.md); C8 | | `001` | 1 | SDBD | D | prefix: the next instruction reads double byte data | | `002`, `003` | 1 | EIS, DIS | I | | | `004` | 3 | J, JE, JD, JSR, JSRE, JSRD | I | below | | `005` | 1 | TCI | - | pulses the TCI pin | | `006`, `007` | 1 | CLRC, SETC | C | | | `008-00F` | 1 | INCR Rd | S Z | C and OV untouched | | `010-017` | 1 | DECR Rd | S Z | | | `018-01F` | 1 | COMR Rd | S Z | one's complement | | `020-027` | 1 | NEGR Rd | S Z C OV | 0 - Rd; NEGR of 0 sets C (C6) | | `028-02F` | 1 | ADCR Rd | S Z C OV | Rd + C | | `030-033` | 1 | GSWD R0-R3 | - | | | `034-035` | 1 | NOP | - | "GSWD to R4/R5" | | `036-037` | 1 | SIN | - | "GSWD to R6/R7": pulses PCIT (S1 p.51) | | `038-03F` | 1 | RSWD Rs | S Z C OV | | | `040-07F` | 1 | shifts and SWAP, R0-R3 | below | bit 2 = two positions | | `080-0BF` | 1 | MOVR Rs,Rd | S Z | TSTR = MOVR r,r; JR = MOVR r,R7 | | `0C0-0FF` | 1 | ADDR Rs,Rd | S Z C OV | | | `100-13F` | 1 | SUBR Rs,Rd | S Z C OV | Rd - Rs | | `140-17F` | 1 | CMPR Rs,Rd | S Z C OV | Rd - Rs, not stored | | `180-1BF` | 1 | ANDR Rs,Rd | S Z | | | `1C0-1FF` | 1 | XORR Rs,Rd | S Z | CLRR = XORR r,r | | `200-23F` | 2 | branches | - | below | | `240-27F` | 1-2 | MVO family | - | register to memory | | `280-2BF` | 1-2 | MVI family | - | memory to register, **no flags** | | `2C0-2FF` | 1-2 | ADD family | S Z C OV | | | `300-33F` | 1-2 | SUB family | S Z C OV | | | `340-37F` | 1-2 | CMP family | S Z C OV | | | `380-3BF` | 1-2 | AND family | S Z | | | `3C0-3FF` | 1-2 | XOR family | S Z | | Register-to-register format `0 ooo sss ddd`; single-register `0 000 ooo ddd` (S1 p.50-51). ### Flags - **C**: carry out of bit 15 of an add. Subtraction and compare are the addition of the two's complement of the subtrahend (S1 p.45), so after SUB/CMP **C = 1 means no borrow**. - **OV**: two's complement overflow of ADD, SUB, CMP, NEGR, ADCR. - **Z**: result is all zero. **S**: bit 15 of the result, **except right shifts and SWAP, which take S from bit 7** (S1 p.53: "Shift Right instructions set the S flip-flop with Bit 7 of the result"). - Logical and move instructions change S and Z only. MVI, MVO, the jumps and the branches change nothing. ### External reference instructions and their modes `1 ooo mmm rrr`: `ooo` = 001 MVO, 010 MVI, 011 ADD, 100 SUB, 101 CMP, 110 AND, 111 XOR; `rrr` = the register (source for MVO, destination otherwise); `mmm` (S1 p.46-48): | mmm | Mode | Effective address | Words | | --- | --- | --- | --- | | 000 | direct | the word after the opcode holds the address | 2 | | 001-011 | indirect R1-R3 | (Rm) | 1 | | 100-101 | indirect R4/R5 | (Rm), then Rm + 1 | 1 | | 110 | stack | MVO: (R6), then R6 + 1 (PSHR). Others: R6 - 1, then (R6) (PULR) | 1 | | 111 | immediate | the word after the opcode (R7 used as a post-incrementing pointer) | 2 | R7 is incremented before the operation, so an instruction with R7 as the destination computes from the address of the next instruction and is a jump (S1 p.48). MVO's odd corners (each a U or C entry): - **MVOI** (`278-27F`, mode 111) writes the register **over its own operand word** (S1 p.57 "MoVe Out Immediate data from register SSS to PC+1"). In ROM it does nothing but cost 9 cycles and advance the PC by 2. - **MVO@ with the pointer as the source** (`MVO@ R4,R4`, `PSHR R6`): "SSS = MMM = 4, 5, 6 or 7 not supported" (S1 p.55). HW26 measured `MVO@ R4,R4` writing the **incremented** pointer; MAME writes the old value (C12). - **MVO R7,addr** writes the PC after the address word (MAME; HW26 saw a game depend on it under MAME only; U8). - MVO in every mode is **not interruptible**. ### SDBD: double byte data `SDBD` (`001`, 4 cycles, not interruptible) sets D for the **next instruction only**. If that is an external reference *read* in an indirect or immediate mode, the CPU makes **two reads** and builds the operand from the **low 8 bits** of each: first read = low byte, second = high byte (S1 p.46, p.49; G82 p.37). | Mode after SDBD | What happens | Source | | --- | --- | --- | | immediate | two operand words; PC + 3 in all | S1 p.49, p.58 | | R4, R5 | two reads, pointer incremented twice | S1 p.49 | | R1-R3 | the **same word read twice**: both bytes equal its low byte | S1 p.49, p.57 | | R6 (stack) | "not supported". HW26 measured: **one decrement, the same word twice**. MAME decrements twice | C9 | | direct | "not supported". HW26 measured: the **address** is built as double byte data from the next two words, then one ordinary read. jzIntv does something else | C10 | | MVO in any mode | G82: SDBD precedes instructions "other than MVO". HW26 measured: D ignored, one normal write | C11 | | anything else (SDBD; ADDR ...) | D is cleared by the next instruction and has no effect (wiki Double Byte Data) | U3 | The SDBD read is 10 cycles where the plain read is 8, and its bus sequence has **no NACT after either DTB** ([timing.md](timing.md)). ### Shifts and SWAP (`040-07F`, R0-R3 only) `0 001 ooo n rr` (S1 p.50): `n` = 0 one position, 1 two positions; never interruptible; 6 cycles, 8 for two positions. | ooo | Mnemonic | One position | Two positions | Flags | | --- | --- | --- | --- | --- | | 000 | SWAP | exchange the bytes | **low byte copied to both halves** (C7) | S (bit 7), Z | | 001 | SLL | left, 0 in | left 2, 0 in | S Z | | 010 | RLC | left through C | left 2: **C is bit 17, OV is bit 16** | S Z C (+OV) | | 011 | SLLC | left, 0 in, bit 15 to C | left 2: old bit 15 to C, **old bit 14 to OV** | S Z C (+OV) | | 100 | SLR | right, 0 in | right 2 | S (bit 7), Z | | 101 | SAR | right, sign copied | right 2, sign copied | S (bit 7), Z | | 110 | RRC | right through C | right 2: **C is bit 16, OV is bit 17** | S (bit 7), Z, C (+OV) | | 111 | SARC | right, sign copied, bit 0 to C | right 2: old bit 0 to C, **old bit 1 to OV** | S (bit 7), Z, C (+OV) | The use of **OV as a second link bit** in the two-position forms is in S1 p.53 but easy to miss and absent from most summaries; it is the "double-shift flag behaviour". In detail (S1 p.53: RLC "using C as bit 17 and OV as bit 16", RRC "using C as bit 16, OV as bit 17", which is one 18-bit rotate read from each end; jzIntv and MAME implement it the same way): - `RLC r,2`: result = (r << 2) | (C << 1) | OV; new C = old bit 15, new OV = old bit 14. - `RRC r,2`: result = (r >> 2) | (C << 14) | (OV << 15); new C = old bit 0, new OV = old bit 1. - `SLLC r,2`, `SARC r,2`: C and OV loaded as in the table; nothing rotates in. - One-position forms **leave OV alone**. - S after a right shift or SWAP is bit 7 of the **result**; after a left shift, bit 15. Z is the whole 16-bit result. For `SWAP r,2` S and Z come from the low byte. ### Branches (`200-23F`, two words) `1 000 s e cccc` + displacement (S1 p.47, p.54). `s` = direction (0 forward, 1 backward), `e` = 1 for BEXT, `cccc` = condition (bit 3 inverts): | cccc | True when | Mnemonic | Inverted (cccc + 8) | | --- | --- | --- | --- | | 0000 | always | B | NOPP (never; still two words) | | 0001 | C = 1 | BC (BLGE) | BNC (BLLT) | | 0010 | OV = 1 | BOV | BNOV | | 0011 | S = 0 | BPL | BMI | | 0100 | Z = 1 | BEQ (BZE) | BNEQ (BNZE) | | 0101 | S xor OV = 1 | BLT | BGE | | 0110 | Z or (S xor OV) = 1 | BLE | BGT | | 0111 | S xor C = 1 | BUSC | BESC | Target: forward = (address of the branch + 2) + displacement; backward = (address + 2) + (displacement xor $FFFF) = address + 1 - displacement (S1 p.47: "the displacement is one's complemented and then added to PC+2"). The displacement is as wide as the memory word; arithmetic is modulo 2^16. **BEXT** (`e` = 1): the low four bits of the instruction register appear on **EBCA0-3**, external logic (a 16-to-1 multiplexer) returns the selected condition on **EBCI**, and the branch is taken when EBCI is high (S1 p.10, p.32). The CPU samples EBCI in TS1 of the fifth microcycle. The direction bit still applies. A BEXT with nothing connected depends on how EBCI is tied (the board's job). A branch **not taken never reads its displacement word**: the CPU issues BAR for PC + 1, then two NACTs, no DTB (G82 Fig. 12a; [timing.md](timing.md)). ### Jumps (`004`, three words) ``` word 1 xxxxxx 0000 000 100 word 2 xxxxxx BB AAAAAA II BB: return register R4+BB (11 = none) word 3 xxxxxx AAAAAAAAAA AAAAAA: target bits 15-10; II: 00 -, 01 EIS, 10 DIS ``` Target = (word 2 bits 7-2) << 10 | (word 3 bits 9-0). With BB = 00, 01, 10 the return address (address of the jump + 3) goes into R4, R5 or R6 (JSR). II = 01 enables and 10 disables interrupts (JE/JSRE, JD/JSRD). **II = 11 is undefined** in every document; HW26 measured it jumping and enabling interrupts (C13). The jumps are interruptible. Return is `MOVR R5,R7` (JR) or `PULR R7`. ### Control - **EIS / DIS**: set and clear INTFF. Not interruptible, so `EIS` followed by a return cannot be interrupted between the two. - **TCI**: "terminate current interrupt": a pulse on the TCI pin for external priority logic (S1 p.13, p.33). No internal effect. - **SIN**: a low pulse on PCIT for external logic to turn into an interrupt request (S1 p.13, p.34). No internal effect. - **CLRC / SETC**: carry. - **HLT**: stops the CPU with the HALT pin high until STPST toggles ([interrupts-and-bus.md](interrupts-and-bus.md), C8). ## What the core does not own Memory, address latches, 10-bit masking of ROM words, bus pull-ups, the interrupt vector, the meaning of the 16 external conditions, wait-state decisions, and the clock. On the Intellivision those are the EXEC ROMs, the STIC, the System RAM's bus-copy mode and so on; none of it belongs here.