# The Object Processor Sources: **[TRM]** p.6-7, 12, 18-24, 133-138 (tier 2); **[NET]** `tom/OB.NET` (746 lines; the state-machine comment at l.243-372 and the equations at l.383-560 were read), `OBDATA.NET`, `WBK.NET` (not read) (tier 2 as text); the libretro project's `docs/jtrm-errata.md` for leads (tier 5; each lead is marked *reported* unless the netlist line is given). The Object Processor (OP) is not a CPU: it stays in the board (package `jaguar_python.tom.op`). It is a bus master that, once per display line (twice with two `HDB` values), walks a linked list of 64-bit *phrases* in DRAM, writes pixels into the line buffer, and **writes the list back**. ## Registers `OLP` (`F00020`, 32 bits, write-only): start of the list. `OBF` (`F00026`): bit 0 is the flag a branch object can test; **any write restarts the OP after a GPU object**. `OB0-OB3` (`F00010-16`, read-only): the current object's first phrase, for the GPU's interrupt routine. Which 16 bits each `OBn` holds is given by the netlist, not the manual (`OB.NET` l.55-67: `OB0` = bits 0-15; *reported* by the errata as the cause of a Val d'Isere bug in Virtual Jaguar). ## Object types (bits 0-2 of the first phrase) [TRM p.18-20] **0 bitmap** (two phrases, 16-byte aligned). Phrase 1: `YPOS` bits 3-13 (in half-lines), `HEIGHT` 14-23, `LINK` 24-42 (replaces bits 3-21 of the list pointer: lists live within 4 MiB), `DATA` 43-63 (bits 3-23 of the pixel address). Phrase 2: `XPOS` 0-11 (signed), `DEPTH` 12-14 (1, 2, 4, 8, 16, 24 bits per pixel), `PITCH` 15-17 (phrases to step per fetched phrase; 0 repeats the phrase), `DWIDTH` 18-27 (phrases per line of data), `IWIDTH` 28-37 (phrases to draw), `INDEX` 38-44 (CLUT high bits), `REFLECT` 45, `RMW` 46 (add to what is in the buffer: signed offsets per CRY field), `TRANS` 47 (colour 0 transparent), `RELEASE` 48 (give up the bus between fetches), `FIRSTPIX` 49-54. **1 scaled bitmap** (three phrases, 32-byte aligned): as above plus `HSCALE` 0-7, `VSCALE` 8-15, `REMAINDER` 16-23 (3.5 fixed point). **2 GPU object**: raises GPU interrupt 3 and **waits** until the GPU writes `OBF`. Bits 14-63 are free data, visible in `OB0-3`. **3 branch**: `YPOS` 3-13, condition code, `LINK` 24-42. Taken: continue at `LINK`; not taken: at the next phrase. **4 stop**: ends the list; may interrupt the 68000 (source 2 of `INT1`). ## Where the netlist corrects or completes the manual | # | Manual | Netlist (`tom/OB.NET`) | Consequence | | --- | --- | --- | --- | | 1 | Branch `CC` is "bits 14-15" but five codes 0-4 are listed [TRM p.20] | the code is **three bits**, decoded from the low three bits of the height field (bits 14-16): l.545-551 `Cctrue0..5` | conflict **C5**; follow the netlist | | 2 | CC 0 "YPOS == VC or YPOS == 7FF", 1 "YPOS > VC", 2 "YPOS < VC", 3 flag set, 4 second half of line | l.545-550: code 0 = equal **or** `YPOS` = `$7FF` (two terms), 1 = `vly`, 2 = `vgy`, 3 = `obf`, 4 = `hcb[10]` | agrees; `vly`/`vgy` come from the comparator at l.626 (operand order to be confirmed by simulation, **U8**) | | 3 | A GPU object "is active when the vertical count matches YPOS unless YPOS = 07FF" [TRM p.20] | state 3: `else if (grpob) { pcinc, grpintreq; goto 7 }`; equation l.430 `D70 := ND2(q3, grpob)`: **no YPOS term** | conflict **C6**: the GPU object fires whenever it is reached. *Reported* by the errata as needed by `yarc` and Primal Rage (CD) | | 4 | A stop object "stops object processing and interrupts the host" [TRM p.20] | l.495 `Obint := AN3(q3, stopob, ypos[0])`: the interrupt needs **bit 3 of the phrase set**; l.496 `Startref := AN2(q3, stopob)`: a stop also starts the pending DRAM refresh | conflict **C7**; follow the netlist | | 5 | Types 5-7 undocumented | l.389 `D01`: any type that is not 0-3 returns to idle; only type 4 gives `startref`/`obint` | types 5-7 end the list silently (no refresh burst) | | 6 | "the object will be active while the vertical counter >= YPOS and HEIGHT > 0" | state 3: `(vc >= ypos) && height > 0`, else `pclink`; scaled: state 9 uses `height` or the integer part of `REMAINDER` | agrees | Items 3-5 are readings of netlist text, not simulations, and the chip revision the netlist represents is unknown ([validation.md](validation.md)). ## The state machine (`OB.NET` l.243-372, in our words) 0. **idle** until the line's start (`HDB1`/`HDB2` match while between `VDB` and `VDE`) **or an overrun**; load the list pointer from `OLP`. 1. request the bus and read phrase 1. 2. when the previous object's data path has finished, read phrase 2. 3. decide by type: a scaled object reads phrase 3 (states 8-9); a bitmap in range starts its data fetch; out of range, follow `LINK`; GPU object: interrupt and wait (state 7) for the `OBF` write; branch: `LINK` or next phrase; stop: refresh, optional interrupt, idle. 4. **data**: fetch a phrase whenever the pixel path is ready, while on screen and `IWIDTH` > 1; then **write phrase 1 back** (new `HEIGHT`, new `DATA`), and for a scaled object phrase 3 (new `REMAINDER`) in state 5; then follow `LINK`. So every displayed object costs: 2 (or 3) header reads, `IWIDTH` data reads (times the ROM/DRAM width factor), and 1 (or 2) header writes, per line, each an arbitrated bus cycle of at least 2 clocks, more on a DRAM row change [TRM p.7]. That is the "how it steals the bus" of [bus-arbitration.md](bus-arbitration.md). ## The list is rewritten as it is processed - After each line, `HEIGHT` decrements (by 2 if interlaced, floor 0) and `DATA` advances by `DWIDTH`; scaled objects step `REMAINDER` by `VSCALE` and may advance several source lines or none [TRM p.18-19, 22]. **The list is therefore consumed by display**: software rebuilds it every frame (typically copying a master list in the vertical interrupt). A frame in which the copy is late shows objects with stale heights: a visible timing dependence games are tuned around. - The write-back happens **at the end of the object's line**, so a 68000 or GPU write to the same phrase races it. Order on the bus decides; nothing in the manual says more (**U9**). - Software may also edit the list mid-frame deliberately (raster effects): the model must read the list from DRAM as the OP reaches each phrase, never from a per-frame snapshot. ## Pixel path [TRM p.22] 1/2/4/8-bit pixels go through the CLUT (two lookups per clock); 16-bit are written as is; 24-bit one per clock. `REFLECT` decrements X; a pair landing on an odd X is split across two entries; `RMW` reads, adds with saturation per field, writes, at half rate; `TRANS` skips colour 0. Scaled objects write one pixel per clock and step X independently of the source counter. ## Documented bugs to reproduce or to assert on [TRM p.133-138] 1. Unscaled 16-bit object data is fetched every **three** clocks, not two. 3. `HILO` transparency swapped on Tom version 1 only (not production). 5. Wide objects clip at the end of the line buffer, not of the screen (costs time). 22. The last column of an **RMW** object can be corrupted if another pixel object follows. 24. **Nothing may outrank the OP**: with GPU `DMAEN` or blitter `BUSHI` set, a higher-priority master taking the bus between an object header's second and third phrase corrupts the line-buffer address: horizontal black stripes. A model without contention shows a clean picture where hardware shows stripes (the errata report exactly this for Virtual Jaguar). The 1995 *Hardware Bugs & Warnings* sheet (image-only, OCRed here; tier 2, dated 26 April 1995) repeats 22 and 24 and adds two Object Processor items the manual's list lacks: **a scaled object's `VSCALE` above 7.0 fails**, and **`HSCALE` other than 1.0 on a 24-bit scaled object distorts it** (page 5). Its workaround for 22 is useful to the model too: an always-false branch object after the RMW object avoids the corruption, which says the corruption happens when the *next bitmap* object starts while the RMW write-back of the last column is pending. ## Timing budget One line is 1,690 system clocks (NTSC). The OP starts at `HDB1`; whatever it has not finished when the next start arrives is cut off. No source gives clock-exact costs beyond "one phrase per 2 clocks in page mode, 3 to 7 more on a row change" [TRM p.7] and the netlist itself; the milestone that builds the OP first matches pictures (tier 5 referees), then matches the netlist's bus-cycle sequence if a simulation becomes available.