[[Category:CP1610]]
The CPU used in the Intellivision [[Category:Master Component]] is a [[General Instruments]] CP1610. The CP1610 is a general purpose microprocessor capable of supporting 16-bit addresses and 10-bit instructions.
==Overview==
| S | [[Sign Flag]] | If set, indicates that the previous operation resulted in negative value, which is determined by a one (1) in bit 15 of the result. |
| C | [[Carry Flag]] | If set, indicates that the previous operation resulted in unsigned integer overflow. |
| Z | [[Zero Flag]] | If set, indicates that the previous operation resulted in zero. |
| O | [[Overflow Flag]] | If set, indicates that the previous operation gave a signed result that is inconsistent with the signs of the source operands. (Signed overflow.) |
| I | [[Interrupt Enable Flag]] | If set, allows the INTRM line to trigger an interrupt, causing the CPU to jump to the interrupt subroutine located in the Executive ROM at $1004. |
| D | [[Double Byte Data Flag]] | If set, it causes the next instruction to read a 16-bit operand with two 8-bit memory accesses, if it supports it. |
| Signal | Name | Direction | Purpose | Use on Intellivision |
| INTRM | INTerrupt Request, Masked. | Input |
A high-to-low transition on this pin causes the CPU to take an interrupt if interrupts are enabled. If the signal transitions back to the "high" state prior to taking the interrupt, the CPU will ignore the interrupt. | Connects to the SR1 output pin on the STIC. The STIC signals [[VBlank Interrupt]] to the CP1610 on this pin, and the CP1610 jumps to the interrupt vector at $1004 after the next interruptible instruction. |
| INTR | INTerrupt Request. | Input |
A high-to-low transition on this pin causes the CPU to take an interrupt, regardless of whether interrupts are enabled. | The Intellivision leaves this signal tied to +5v (deasserted). |
| BUSRQ | BUS ReQuest. | Input |
A high-to-low transition on this pin requests that the CPU halt so that something else may access the bus. |
Connects to the SR2 output pin on the STIC. The STIC signals the CP1610 on this pin at points during active display when it needs to access [[System RAM]]. The CP1610 halts after the next interruptible instruction, regardless of whether interrupts are enabled. |
| BUSAK | BUS AcKnowledge. | Output |
Asserted (active-low output) when the CPU has yielded the bus. |
Connects to the SST input pins on the System RAM and the [[Graphics ROM|GROM]]. The CP1610 acknowledges the STIC's bus request by signaling to the System RAM and GROM that it halted by request of the STIC. |
| MSYNC | Master SYNC. | Input |
Asserting this signal (active low) resets the CPU and synchronizes it to its clocks. |
Connects to the MSYNC output of the STIC. The STIC generates this signal shortly after powerup after the clock stabilizes, or whenever someone releases the reset button or asserts RESET on the cartridge port. |
| EBCA0 - EBCA3 | External Branch Condition Address. | Output |
The four outputs EBCA0 through EBCA3, along with the single input ECBI provide a mechanism for external hardware to generate branch control inputs to the CPU. The BEXT instruction includes a 4-bit field that the CP1610 asserts on EBCA0 - EBCA3. External hardware then asserts a 0 or 1 on EBCI to indicate whether to take the branch. This allows up to 16 different branch conditions to be asserted to the CPU. |
These pins are not connected in the Intellivision, so the BEXT instruction is typically never used. |
| EBCI | External Branch Condition Input. | Input |
| TCI | Terminate Current Interrupt. | Output |
TCI is both an instruction as well as a pin on the device. The TCI instruction pulses the TCI pin on the CP1610. |
The Intellivision leaves this signal unconnected, and so the TCI instruction is effectively a NOP. |
| PCIT | Program Counter Inhibit/Trap. | Bidirectional. |
External hardware can prevent the CPU from incrementing the program counter by asserting this signal. The SIN instruction generates a pulse on this line. | The Intellivision leaves this signal tied to +5v (deasserted) through a resistor. |
| STPST | SToP-STart. | Input | Stops or starts the execution of the CPU whenever it sees a high-to-low transition. Can restart the CPU after a [[HLT]] instruction. | The Intellivision leaves this signal tied to +5v. |
| HALT | HALTed. | Output | Indicates the CPU halted, either due to STPST or a [[HLT]] instruction. | The Intellivision leaves this signal unconnected. |
| BDRDY | Bus Data ReaDY. | Input | When deasserted, it causes the CPU to wait for data to become available on the bus, effectively inserting wait states. | The Intellivision leaves this signal unconnected, and thus has no notion of wait states. |
| [[Implied Mode|Implied]] | The opcode's inputs or outputs are implied by the opcode itself. |
| [[Register Mode|Register]] | The value to be read or written is contained in one or more registers. No memory access are required to execute Register-mode opcodes. |
| [[Direct Mode|Direct]] | The address of the value to be read or written is specified by the value immediately following the address of the opcode. |
| [[Immediate Mode|Immediate]] | The address of the value to be read or written is the address immediately following the opcode. Note that immediate mode addressing is really just Indirect addressing using the R7 register. |
| [[Indirect Mode|Indirect]] | The address of the value to be read or written is contained in one of the registers. |
| [[Stack Mode|Stack]] | This [[Indirect Mode]] through R6, the stack pointer. |
| Range | Instruction | Mnemonic(s) | Cycles | Interruptible | Input Flags | Output Flags |
| S | Z | O | C | D | S | Z | O | C | I | D |
| $0000 | [[HLT|Halt]] | [[HLT]] | NA | No | | |
| $0001 | [[SDBD|Set Double Byte Data]] | [[SDBD]] | 4 | No | | | D |
| $0002 | [[EIS|Enable Interrupt System]] | [[EIS]] | 4 | No | | | I | |
| $0003 | [[DIS|Disable Interrupt System]] | [[DIS]] | 4 | No | | | I | |
| $0004 | [[Jump]] | [[J]] | 12 | Yes | | |
| [[JE]] | 12 | Yes | | | I | |
| [[JD]] | 12 | Yes | | | I | |
| [[JSR]] | 12 | Yes | | |
| [[JSRE]] | 12 | Yes | | | I | |
| [[JSRD]] | 12 | Yes | | | I | |
| $0005 | [[TCI|Terminate Current Interrupt]] | [[TCI]] | 4 | No | | |
| $0006 | [[CLRC|Clear Carry]] | [[CLRC]] | 4 | No | | | C | |
| $0007 | [[SETC|Set Carry]] | [[SETC]] | 4 | No | | | C | |
| $0008-$000F | [[INCR|Increment Register]] | [[INCR]] | 6 | Yes | | S | Z | |
| $0010-$0017 | [[DECR|Decrement Register]] | [[DECR]] | 6 | Yes | | S | Z | |
| $0018-$001F | [[COMR|Complement Register]] | [[COMR]] | 6 | Yes | | S | Z | |
| $0020-$0027 | [[NEGR|Negate Register]] | [[NEGR]] | 6 | Yes | | S | Z | O | C | |
| $0028-$002F | [[ADCR|Add Carry to Register]] | [[ADCR]] | 6 | Yes | | C | | S | Z | O | C | |
| $0030-$0033 | [[GSWD|Get the Status Word]] | [[GSWD]] | 6 | Yes | S | Z | O | C | | |
| $0034-$0035 | [[NOP|No Operation]] | [[NOP]] | 6 | Yes | | |
| $0036-$0037 | [[SIN|Software Interrupt]] | [[SIN]] | 6 | Yes | | |
| $0038-$003F | [[RSWD|Return Status Word]] | [[RSWD]] | 6 | Yes | | S | Z | O | C | |
| $0040-$0047 | [[SWAP|Swap Bytes]] | [[SWAP]] | 6/8 | No | | S | Z | |
| $0048-$004F | [[SLL|Shift Logical Left]] | [[SLL]] | 6/8 | No | | S | Z | |
| $0050-$0057 | [[RLC|Rotate Left through Carry]] | [[RLC]] | 6/8 | No | | O | C | | S | Z | O | C | |
| $0058-$005F | [[SLLC|Shift Logical Left through Carry]] | [[SLLC]] | 6/8 | No | | O | C | | S | Z | O | C | |
| $0060-$0067 | [[SLR|Shift Logical Right]] | [[SLR]] | 6/8 | No | | S | Z | |
| $0068-$006F | [[SAR|Shift Arithmetic Right]] | [[SAR]] | 6/8 | No | | S | Z | |
| $0070-$0077 | [[RRC|Rotate Right through Carry]] | [[RRC]] | 6/8 | No | | O | C | | S | Z | O | C | |
| $0078-$007F | [[SARC|Shift Arithmetic Right through Carry]] | [[SARC]] | 6/8 | No | | O | C | | S | Z | O | C | |
| $0080-$00BF | [[MOVR|Move Register]] | [[MOVR]] | 6/7 | Yes | | S | Z | |
| $00C0-$00FF | [[ADDR|Add Registers]] | [[ADDR]] | 6 | Yes | | S | Z | O | C | |
| $0100-$013F | [[SUBR|Subtract Registers]] | [[SUBR]] | 6 | Yes | | S | Z | O | C | |
| $0140-$017F | [[CMPR|Compare Registers]] | [[CMPR]] | 6 | Yes | | S | Z | O | C | |
| $0180-$01BF | [[ANDR|And Registers]] | [[ANDR]] | 6 | Yes | | S | Z | |
| $01C0-$01FF | [[XORR|Xor Registers]] | [[XORR]] | 6 | Yes | | S | Z | |
| $0200-$023F | [[Branch]] | [[B]] | 9 | Yes | | |
| [[BC]] | 7/9 | Yes | | C | | |
| [[BOV]] | 7/9 | Yes | | O | | |
| [[BPL]] | 7/9 | Yes | S | | |
| [[BEQ]] | 7/9 | Yes | | Z | | |
| [[BLT]] | 7/9 | Yes | S | | O | | |
| [[BLE]] | 7/9 | Yes | S | Z | O | | | |
| [[BUSC]] | 7/9 | Yes | S | | C | | |
| [[NOPP]] | 7 | Yes | | |
| [[BNC]] | 7/9 | Yes | | C | | |
| [[BNOV]] | 7/9 | Yes | | O | | |
| [[BMI]] | 7/9 | Yes | S | | |
| [[BNEQ]] | 7/9 | Yes | | Z | | |
| [[BGE]] | 7/9 | Yes | S | | O | | |
| [[BGT]] | 7/9 | Yes | S | Z | O | | | |
| [[BESC]] | 7/9 | Yes | S | | C | | |
| [[BEXT]] | 7/9 | Yes | | |
| $0240-$0247 | [[MVO|Move Out]] | [[MVO]] | 11 | No | | |
| $0248-$026F | [[MVO@|Move Out Indirect]] | [[MVO@]] | 9 | No | | D | |
| $0270-$027F | [[MVOI|Move Out Immediate]] | [[MVOI]] | 9 | No | | D | |
| $0280-$0287 | [[MVI|Move In]] | [[MVI]] | 10 | Yes | | |
| $0288-$02AF | [[MVI@|Move In Indirect]] | [[MVI@]] | 8/10/11 | Yes | | D | |
| $02B0-$02BF | [[MVII|Move In Immediate]] | [[MVII]] | 8/10 | Yes | | D | |
| $02C0-$02C7 | [[ADD|Add]] | [[ADD]] | 10 | Yes | | S | Z | O | C | |
| $02C8-$02EF | [[ADD@|Add Indirect]] | [[ADD@]] | 8/10/11 | Yes | | D | S | Z | O | C | |
| $02F0-$02FF | [[ADDI|Add Immediate]] | [[ADDI]] | 8/10 | Yes | | D | S | Z | O | C | |
| $0300-$0307 | [[SUB|Subtract]] | [[SUB]] | 10 | Yes | | S | Z | O | C | |
| $0308-$032F | [[SUB@|Subtract Indirect]] | [[SUB@]] | 8/10/11 | Yes | | D | S | Z | O | C | |
| $0330-$033F | [[SUBI|Subtract Immediate]] | [[SUBI]] | 8/10 | Yes | | D | S | Z | O | C | |
| $0340-$0347 | [[CMP|Compare]] | [[CMP]] | 10 | Yes | | S | Z | O | C | |
| $0348-$036F | [[CMP@|Compare Indirect]] | [[CMP@]] | 8/10/11 | Yes | | D | S | Z | O | C | |
| $0370-$037F | [[CMPI|Compare Immediate]] | [[CMPI]] | 8/10 | Yes | | D | S | Z | O | C | |
| $0380-$0387 | [[AND|And]] | [[AND]] | 10 | Yes | | S | Z | |
| $0388-$03AF | [[AND@|And Indirect]] | [[AND@]] | 8/10/11 | Yes | | D | S | Z | |
| $03B0-$03BF | [[ANDI|And Immediate]] | [[ANDI]] | 8/10 | Yes | | D | S | Z | |
| $03C0-$03C7 | [[XOR|Xor]] | [[XOR]] | 10 | Yes | | S | Z | |
| $03C8-$03EF | [[XOR@|Xor Indirect]] | [[XOR@]] | 8/10/11 | Yes | | D | S | Z | |
| $03F0-$03FF | [[XORI|Xor Immediate]] | [[XORI]] | 8/10 | Yes | | D | S | Z | |