# The IOP, and PlayStation compatibility mode Sources: ps2tek "IOP Hardware and Peripherals", "IOP Interrupts", "IOP DMA", "IOP Timers", "BIOS Boot Process", "BIOS PlayStation Compatibility" (tier 3, facts only); Sony's SPU2 Overview Manual §1.1.1 (DOC) for the clock; MAME 0.285's traces (OBSERVED, `../ee-python/docs/mame-oracle.md`); judges: ps2autotests `cpu/iop/*` (7 IRX programs: `alu`, `branch`, `branchdelay`, `hilodelay`, `lsu`, `lsudelay`, `muldiv`) and `kernel/iop/*` (16) (ISC, TEST ROM). Sony's IOP manuals are not among the pinned documents; **the IOP's own hardware is the least documented part of this board**. ## The core: reuse r3000a-python The IOP is "a duplicate of the PSX's CPU" (ps2tek): a MIPS R3000A-class core, the same ISA as `../r3000a-python` (the CW33300 configuration Sony used in the PS1). So **the board pins r3000a-python** and adds nothing to the ISA. What differs, and where each difference lives: | Difference | Evidence | Where it goes | | --- | --- | --- | | Clock 36.864 MHz in PS2 mode, 33.8688 MHz in PS1 mode | SPU2 manual §1.1.1 (DOC); ps2tek (tier 3); MAME uses 33.8688 MHz in PS2 mode too (OBSERVED, C2 in memory-map.md) | board (time base) | | **PRId**: the shared boot ROM sends PRId < 59h to the IOP's code, and PRId < 0Fh (or I/O bit 1F801570h.3) to TBIN, the PS1 BIOS inside the PS2 BIOS | ps2tek "BIOS Boot Process", "BIOS PlayStation Compatibility"; the MAME IOP trace takes the branch at BFC0000Ch, then tests `slti r8,0x10` at BFC02030h (OBSERVED) | **core configuration**: the IOP's PRId value, and whether it changes in PS1 mode (**U23**) | | Cache control at FFFE0000h (KSEG2) | ps2tek IOP memory map | core (r3000a's FFFE0130h BIU/cache-control register; r3000a U11 asks about other KSEG2 addresses: this board is a second user) | | I-cache, scratchpad: present, and the same sizes as the PS1's? | not stated in our sources | core configuration (**U24**) | | **GTE** in PS1 mode | PS1 games execute COP2 GTE instructions on the IOP, and PS1DRV emulates only the GPU (ps2tek), so the IOP chip must answer them: HYPOTHESIS, strongly implied; whether COP2 is usable in PS2 mode is unknown | core configuration; answers r3000a-python's **U14** provisionally ("present") | | Interrupts: I_STAT/I_MASK as on the PS1 plus **I_CTRL** (1F801078h: reading returns bit 0 and clears it), and 26 sources (VBLANK start/end, CDVD, DMA, timers 0-5, SIO0/1, SPU2, PIO, PCMCIA/DEV9, SIO2, USB, FireWire...) | ps2tek "IOP Interrupts" | board | | DMA: the PS1's channels 0-6 (MDECin, MDECout, SIF2 = GPU in PS1 mode, CDVD = CD-ROM in PS1 mode, SPU, PIO, OTC) plus 7-12 (SPU2 core 1, DEV9, SIF0, SIF1, SIO2in, SIO2out) and DPCR2, DICR2, DMACEN, DMACINTEN | ps2tek "IOP DMA" | board | | Timers 0-2 (16-bit, as the PS1's) and 3-5 (32-bit, with prescalers) | ps2tek "IOP Timers" | board | | SIO2 (pads and cards), CDVD registers, SPU2, SIF registers | ps2tek | board (sif.md, cdvd-mechacon.md, spu2.md, pads-and-cards.md) | **Proposal for r3000a-python (decision P11):** its decision 2 ("one class, `CW33300`, no generic base until a second configuration appears") meets its second configuration here. Add `r3000a_python.IOP` (or a `CW33300(config=...)` parameter) carrying: PRId, the presence of the scratchpad and the GTE, the KSEG2 register set, and a hook the board calls when PS1 mode is entered. The ISA and the bus contract stay as they are. This is a change to raise **on the core** when ps2-python reaches the IOP (milestone M5), not now. ## PlayStation compatibility mode As ps2tek describes it (tier 3, partly marked "probably" by its authors): - OSDSYS detects a PS1 disc and loads **PS1DRV**, an EE program from the BIOS. PS1DRV reads hack databases (an internal list, a `PSD1.0.0` entry in the disc's SYSTEM.CNF, a TITLE.DB on a memory card), remaps the SPU2's registers to the PS1's 1F801C00h, asserts bit 19 of SIF_CTRL ("probably" the IOP's reset), waits, releases it, and enters a loop that **translates the PS1 GPU's commands into GS drawing**: the PS1 GPU is emulated in software on the EE and drawn by the GS. - The IOP restarts into **TBIN**, the PS1 BIOS without its shell, at 33.8688 MHz; the SPU2 outputs 44.1 kHz. - PS1DRV applies per-game timing hacks (render delays, VRAM read delay, extra VBLANK lines, a timer delay), because the translation's timing differs from a PS1's. Consequences for this family: - **PS1 mode is a different machine from psx-python's.** The CPU core is shared (r3000a-python); the GPU is not a chip at all here but EE software on the GS; the SPU is the SPU2 in a compatibility mode; the CD goes through the CDVD and the MechaCon. None of psx-python's GPU, SPU or CD-ROM models applies. - The faithful way is to run it as the hardware does: the real PS1DRV on ee-python, TBIN on the IOP, the GS drawing. Its correctness then follows from the EE, GS, SPU2 and CDVD models, and its timing quirks are PS1DRV's own (the hacks it applies are its, not ours). - It is a **late milestone** (M9 in the handoff brief) and it costs the EE's full speed problem plus a PS1 game's load: a PS1 game on ps2-rust is slower than on psx-rust by the EE's cost (execution-architecture.md). ## Unknowns U23 the IOP's PRId in PS2 and PS1 modes; U24 the IOP's caches and scratchpad; U25 what SIF_CTRL bit 19 does (ps2tek: "probably" reset); U26 the IOP's memory-access timing (PS1 values?); U27 whether later console models implement the IOP differently (not covered by our pinned sources); U28 the PS1-mode clock switch's timing.