# Interrupts, bus requests, reset, halt and the other control pins Source tags as in [start-here.md](start-here.md). ## The one rule: interruptible and non-interruptible instructions After each instruction the CPU either looks at its request lines or it does not. The instruction just finished decides (S1 p.12-13, p.22 Fig. 2-6, G82 2.5.5): - after an **interruptible** instruction it honours, in this order, a bus request (BUSRQ), INTR, then INTRM if the interrupt enable is set, and a pending stop (STPST or HLT); - after a **non-interruptible** instruction it goes straight to the next fetch. A request stays pending. So a run of non-interruptible instructions **delays interrupts and bus requests** by its whole length. This is the rule programs on the Intellivision live by: the STIC asks for the bus for a bounded time and gives up if the CPU has not granted it (wiki CP1610 "Interruptibility"; the board's concern), and a masked interrupt is not "remembered" past the request (below). Non-interruptible (S1 p.53 "Shifts are not interruptable", p.55-56; G82 p.45; wiki CP1610 table): | Group | Opcodes | | --- | --- | | SDBD, EIS, DIS, TCI, CLRC, SETC | `001-003`, `005-007` | | every shift, rotate and SWAP | `040-07F` | | MVO in every mode (MVO, MVO@, PSHR, MVOI) | `240-27F` | | HLT | `000` (wiki; the manuals do not say) | Everything else is interruptible in the manuals and the wiki's table. Votes against (all in [undocumented-behavior.md](undocumented-behavior.md)): - **jzIntv treats GSWD and RSWD as non-interruptible**, and a JD/JSRD as not granting the bus (C14; HYPOTHESIS: read from its GPL source before the 2026-11-14 rule, as are this file's other jzIntv statements; for review). - The wiki's SIN page says SIN is not interruptible; its table, S1 p.13 ("the interrupt will be acknowledged at the end of the SIN instruction") and MAME say it is (C15). - HW26's `hw_grant` cartridge measured, on one console, that the bus is lent **only after interruptible instructions** (the pattern of GI's rule at 15 probe loops mixing MVO, MVOI, MVI, MVII, SDBD, NOP, INCR and B), not after every instruction and not by look-ahead. That is the only hardware evidence found for the rule itself (tier 3, one console, read off a screen). Because SDBD is not interruptible, nothing can come between it and the instruction it prefixes; D never needs saving. ## INTR and INTRM | | INTR* | INTRM* | | --- | --- | --- | | Masked by | nothing | the interrupt enable flip-flop (EIS/DIS, JE/JD, JSRE/JSRD; cleared by MSYNC) | | Priority | higher | lower | | Vector | supplied on the bus during IAB by external logic | the same mechanism | The sequence (S1 p.24-25, p.35; nine microcycles in the figure): | Cycle | Phase | Bus | | --- | --- | --- | | 1 | INTAK | CPU drives R6: devices latch it as an address; priority logic sees the acknowledge | | 2 | NACT | | | 3 | DW | CPU drives the PC (the address of the instruction that would have run next) | | 4 | DWS | the same; the stack word is written. R6 is incremented | | 5 | NACT | | | 6 | IAB | external logic drives the service routine's address; the CPU loads R7 from it | | 7-9 | NACT | | | | BAR | first fetch of the service routine | - **Nothing else is saved and the interrupt enable is not changed** (no source says it is; MAME and HW26 leave it alone). A service routine that must not nest relies on the request being an edge, or disables interrupts itself. - **Level or edge** (C16): S1 calls both lines "low active" and says the CPU samples them every TS1. The wiki says a high-to-low transition requests the interrupt and that the request is dropped if the line goes high before it is taken. MAME sets INTRM pending on assert, clears it on release or when taken, and latches INTR until taken. On the Intellivision the request line stays low for about a quarter of a frame and the service routine is not re-entered, so a pure level model is wrong for that board; "edge, dropped on release" fits every source and HW26's `hw_frame2` (a VBlank request made with interrupts disabled and released before EIS gives no interrupt). - The interrupt sequence is itself not followed by a request check: the first instruction of the service routine always runs (MAME, HW26's model; no manufacturer statement; U10). - How many microcycles before the end of an instruction a request must arrive to be taken at that boundary is not stated anywhere (U9). - TCI (the instruction and the pin) and SIN/PCIT exist for external priority and trap logic (S1 chapter 4.5); they change nothing inside the CPU. ## BUSRQ and BUSAK (S1 p.13, p.24, p.36; G82 Fig. 16; O81 p.2-13.) 1. BUSRQ* is sampled every TS1. It is acted on only at the end of an interruptible instruction. 2. The CPU floats the bus and runs NACT cycles; **BUSAK* goes low at the start of the first NACT**. No entry overhead. 3. It stays there for as long as BUSRQ* is low: "indefinite duration" (S1 p.24); these NACTs refresh the dynamic logic (O81), unlike BDRDY waits. 4. When BUSRQ* is sampled high, **two more NACT cycles** follow, then BUSAK* goes high and the next BAR (or INTAK: bus requests are honoured before interrupts, S1 p.25) is issued. 5. Whether a BUSRQ* that falls again during those two cycles restarts the wait without BUSAK* rising is not drawn anywhere (U11). BUSRQ is independent of the interrupt enable. ## BDRDY (wait states) After every BAR and ADAR the CPU samples BDRDY in the following TS1. Low inserts NACT wait cycles, re-sampled every microcycle, before the DTB (S1 p.21, p.37, p.39); the wait must be shorter than 40 µs. Whether write sequences (BAR NACT DW DWS) wait the same way follows from "every micro state in which a BAR or ADAR bus control signal is issued" (S1 p.39) and is not drawn (U12). ## MSYNC (reset) - MSYNC* low for at least 10 ms after power-up forces NACT, floats the bus and **disables the interrupt system**. Registers and status bits are arbitrary (S1 p.21). It must rise on a φ1 edge (that edge becomes TS3). - After it rises: **NACT, IAB, NACT, NACT, NACT, then the first BAR** (S1 p.27 as drawn; O81 p.2-13 lists exactly this). During IAB external logic supplies the start address; an undriven bus gives whatever the bus floats to (S1 p.21: "the default address resulting from the logical state of the non-driven bus"). - A reset while running: MSYNC is the only reset there is. jzIntv keeps the registers across a reset; MAME's device zeroes its flags at start. ## STPST and HALT - **STPST** is a falling-edge toggle. Running: the CPU stops **after the next interruptible instruction** and raises HALT. Stopped: the next falling edge restarts it, at the end of the next NACT cycle (S1 p.13; O81 p.2-12). - **HLT**: S1 p.56 "HaLT after next instruction is executed. Resume on control start"; G82 p.34 "Halt after next **interruptable** instruction is executed"; the wiki says the CPU stops at once and ignores interrupts until reset or STPST; MAME does nothing (4 cycles, "TBD"); jzIntv stops the emulation (C8). - Whether an interrupt or reset ends a halt: reset must (MSYNC overrides everything); an interrupt is not said to (U13). ## PCIT Bidirectional (S1 p.13, p.34): - as an **input**, low inhibits the increment of the PC during the fetch of every instruction; S1 recommends changing it only while the CPU is stopped and warns about multiword instructions (U14). It is the hook for a front panel to jam instructions. - as an **output**, SIN pulses it low. ## EBCA and EBCI See BEXT in [start-here.md](start-here.md). EBCA0-3 are "the buffered outputs from the 4 least significant bits of the instruction register" (S1 p.10): they show the low four bits of every opcode, and mean something only during BEXT. ## What a board must be able to do through the core's interface 1. see every phase in order, with the CPU's word in BAR, DW, DWS and INTAK; 2. return a word in DTB and IAB (and keep its own latch in BAR, ADAR, INTAK); 3. raise and release INTR, INTRM and BUSRQ at any microcycle and have them sampled by the rule above; 4. see BUSAK and HALT in every microcycle; 5. answer the 16 external conditions; 6. optionally stretch an access (BDRDY), stop and start the CPU (STPST), and receive the TCI and SIN pulses.