# Start here: the Jaguar's two RISC processors as a core author needs them The Atari Jaguar (1993) has two custom chips by Flare II for Atari: **Tom** (graphics: the GPU, the Blitter, the Object Processor, video, the memory controller) and **Jerry** (sound and I/O: the DSP, timers, I2S, UART, joystick decode). The GPU in Tom and the DSP in Jerry are **the same RISC design** in two variants: "The DSP ... is a variant of the GPU within Tom. It uses a very similar instruction set and programming model" (TRM p.97). The community calls the architecture **JRISC**; Atari's manual says "Graphics Processor (GPU)" and "DSP". This repository builds both as one core; the console is the board, [jaguar-python](../../jaguar-python) (prepared in parallel; read-only here). The CoJag arcade boards use the same two processors at 26 MHz. Paths: `NET/` is `reference/src/JagNetlists/netlists_org/`, TRM is the *Technical Reference Manual* rev. 8, both fetched by `scripts/fetch_references.py`. Tiers are defined in [validation.md](validation.md). **Nothing here was run on hardware**; the most authoritative source is the designers' netlist ([netlists.md](netlists.md)), read by hand and not yet simulated. ## The two variants | | GPU (Tom) | DSP (Jerry) | Source | | --- | --- | --- | --- | | clock | system clock, 26.590906 MHz NTSC (26 MHz CoJag) | same | MAME `-listxml` | | registers | 2 banks x 32 x 32 bit | same | TRM p.42 | | local RAM | 4 KB at `F03000` (1K x 32) | 8 KB at `F1B000` | TRM p.36, p.97-98 | | other local space | control registers `F02100-F0211F`, Blitter registers `F02200-F022FF` | control registers `F1A100-F1A123`, DAC/I2S registers `F1A140-F1A157`, wave ROM `F1D000-F1DFFF` | TRM p.30, p.36, p.98, p.111 | | external bus | 64-bit coprocessor bus via the gateway | **16-bit** via Jerry's gateway | TRM p.29, p.97 | | interrupts | 5 (0 CPU, 1 Jerry, 2 timer, 3 OP, 4 Blitter) | 6 (0 CPU, 1 I2S, 2 timer 0, 3 timer 1, 4 ext 0, 5 ext 1) | TRM p.38, p.98 | | vector base | `F03000` + 16n | `F1B000` + 16n | `INTER-UA.NET`, `DSP_INT.NET` | | opcodes 32, 33, 42, 48, 62, 63 | SAT8, SAT16, LOADP, STOREP, SAT24, PACK/UNPACK | SUBQMOD, SAT16S, SAT32S, MIRROR, undefined, ADDQMOD | TRM p.100 | | MAC accumulator | 32 bits | 40 bits (top 8 at `F1A120`) | TRM p.99 | | extra registers | HIDATA `F02118` (phrase high half) | MOD `F1A118`, MACHI `F1A120` | TRM p.61, p.111 | | MMULT matrix in RAM | `F03xxx` (MTXADDR bits 2-11) | `F1Bxxx` only, the low 4 KB (Jerry bug 6) | TRM p.59, p.141 | | END register | BIG_IO, BIG_PIX, BIG_INSTR | BIG_IO, BIG_INSTR | TRM p.59-60, p.109-110 | | microcode ROM | present in the archive | **missing**; six words reconstructed by MiSTer | [netlists.md](netlists.md) | | CTRL version field | 2 | 2 | TRM p.61, p.111 | So the variants differ only in **data**: RAM size and base, the six opcode slots, the interrupt count, accumulator width, which extra registers exist, the MMULT address mask, the external bus width. Everything else (pipeline, scoreboard, divider, systolic unit, interrupt logic) is the same netlist text (`SBOARD`, `EXECON`, `SYSTOLIC` byte-identical; `DIVIDE` one declaration edit). ## Registers and banks - 64 general registers, 32 visible: bank 0 ("primary") and bank 1 ("secondary"). **FLAGS bit 14 REGPAGE** selects bank 1; **IMASK forces bank 0** whatever REGPAGE says (TRM p.42-43). MOVETA/MOVEFA reach the other bank; **MMULT always reads its register matrix from bank 1** (TRM p.42). - Conventions the hardware imposes: **R31 (bank 0) is the interrupt stack pointer, R30 (bank 0) is corrupted on every interrupt** (TRM p.38); **R14 and R15** are the base registers of the indexed loads and stores. - **PC** is 23 bits counting words, i.e. byte address bits 1-23; a jump to an odd address drops bit 0, addresses ignore bits 24-31 (`PREFETCH.NET` l.330-355: `Pcin` from `srcd{1-23}` or `gpu_din{1-23}`). It can be written only while GO is clear (`Loadpc := AN2 (loadpc, pcwr, go\)`, TRM p.60). At reset it holds **`FF0008`** in both chips (the comment "initialised to internal ROM = FF0008" and the reset values of the flip-flops, `PREFETCH.NET` l.344-353, `DSP_F-35.NET` l.342-353; read, not simulated: this settles the draft's U7). Tom's boot-time LOCK (GPU runs from `FF0008` until a cartridge check passes, TRM p.133) is the board's. - Flags: Z (bit 0), C (bit 1), N (bit 2) of FLAGS, the rest of FLAGS being the interrupt and bank controls ([interrupts.md](interrupts.md)). ## Memory as the processor sees it - One flat 24-bit byte address space. Accesses inside the processor's **local space** (its own RAM and control registers, and for the GPU the Blitter registers on the same local bus) take no external bus cycle and are always 32-bit: LOADB/LOADW/LOADP and the matching stores do a 32-bit access there (TRM p.36-37, p.49-50). Everything else goes through the **gateway** to the external bus as an 8-, 16-, 32- or 64-bit transfer (GPU) or a sequence of 16-bit transfers (DSP). - The processor reads its own registers only by `MOVE PC` and LOAD/STORE of the local control-register addresses; "If the GPU reads [the PC], this must be performed by the MOVE PC,Rn instruction, and not by performing a load from it" (TRM p.60). - Other masters (68000, Blitter, the other RISC) reach the local space through the **slave port**, as 16-bit pairs low address first, or as 32-bit write-only at `+$8000` (TRM p.31, p.43). Slave access has the highest priority on the local bus, above the processor's own operands and fetches (TRM p.36). - Instruction order within a long: low word first, or high first with BIG_INSTR; MOVEI data always low word first (TRM p.60). ## Starting and stopping CTRL bit 0 **GO**: any master may set it after writing the PC; only the processor itself should clear it (Tom bug 23). Clearing GO discards the prefetch queue and "the program counter value will be corrupted" (TRM p.60). SINGLE_STEP and SINGLE_GO give an instruction-at-a-time debug mode driven from outside (TRM p.40). ## Where to read next 1. [instruction-set.md](instruction-set.md): both opcode maps, flags, divide, MAC, MMULT, the register map. 2. [pipeline-and-bugs.md](pipeline-and-bugs.md): prefetch, delay slot, scoreboard, every documented bug and who owns it. 3. [interrupts.md](interrupts.md): latches, IMASK, priority, entry. 4. [timing.md](timing.md): ticks, stalls, external bus, speed. 5. [netlists.md](netlists.md), [validation.md](validation.md), [mame-oracle.md](mame-oracle.md), [census.md](census.md). 6. [handoff-brief.md](handoff-brief.md): what the core owns, the contract, the rungs, and the decisions.