# Handoff: build `gamecube-python`, the Nintendo GameCube board ## Context you are inheriting The family's shape (charter): CPUs get their own cores; boards compose pinned cores; `x-python` is the specification. This board's CPU is `gekko-python` (Phase 0 beside it, `../gekko-python`); its DSP is proposed as a core of its own (decision 3). The GameCube is an **era 4** machine in the charter's table ("thin evidence; instruction and functional levels dominate; turbo with recompilation; concessions likely on weak targets"), and the first family board for which the no-JIT path does not reach real time on any target for typical games (domains-and-speed.md). Read n64-python's execution-architecture.md and the late-era method proposal (emulator-lineage docs/proposals/2026-11-late-era-method.md, a draft) before planning any milestone that runs more than a test program. Rules that bind this work: oracle tiers (validation.md); Python floor 3.11, PyPy green; reference boards are correct, not fast; never copy a chip file between repositories; no hardware probes; run anything that reads `reference/` with `python -I`; Dolphin and every other GPL/LGPL/unlicensed emulator are closed boxes (built and run from emu-tools-gpl, never fetched here); Nintendo's IPL, DSP ROMs and drive firmware are identified by SHA-1 only, never copied, traced, disassembled or read; discs through `$REDUMP_DIR`; firmware through `$REDUMP_DIR` and `$MAME_ROMPATH`. ### Read, in this order 1. `README.md`, `docs/start-here.md`, `docs/memory-map.md`. 2. `docs/gx.md`, `docs/dsp-audio.md`, `docs/dvd-exi-si.md`, `docs/ipl-firmware.md`. 3. `docs/domains-and-speed.md`, `docs/execution-architecture.md`. 4. `docs/census.md`, `docs/validation.md`, `docs/mame-oracle.md`, `docs/sources-gamecube.md`. 5. YAGCD in `reference/yagcd/` (after `python -I scripts/fetch_references.py`; regenerate text with any HTML-to-text step: not committed), chapters 4, 5, 6, 9, 10, 12, 13. 6. gekko-python's handoff brief, for the CPU's side of the bus. ## Scope The retail GameCube (DOL-001 and DOL-101; NTSC, PAL, MPAL), from a side-loaded DOL or a disc image through the skip-IPL boot or the player's IPL: PI, MI, main memory, VI, GX (CP, XF, SU/RAS, TX/TMEM, TEV, PE, EFB, copies, peeks, bounding box), the DSP interface, ARAM and its DMA, AI (AID and AIS), DI with a functional drive, EXI (memory cards, the IPL/RTC/SRAM chip), SI (controllers). Later: the broadband adapter, the GBA link and Game Boy Player (sockets for gba-python), development hardware (NPDP, TDEV: the census has their IPLs), the Panasonic Q. Not this board: the Triforce (a separate board that pins this one) and the Wii (a later Phase 0 pins this board and gekko-python). ## Proposed names - Repository `gamecube-python`, package `gamecube_python`; class `GameCube`, with `machine="dol-001-ntsc"` style rows (console board revision x video region). - Modules: `bus.py` (PI decode, the 60x transaction interface the core calls), `mi.py`, `pi.py` (interrupts, FIFO pointers), `vi.py`, `gx/` (a package: `cp.py`, `xf.py`, `raster.py`, `texture.py`, `tev.py`, `pe.py`, `efb.py`, `copy.py`), `dsp_interface.py` (mailboxes, control, ARAM DMA, AID DMA), `aram.py`, `ai.py`, `di.py`, `drive.py` (functional), `exi.py`, `ipl_chip.py` (descrambler, RTC, SRAM), `memcard.py`, `si.py`, `pads.py`, `disc.py` (the disc-source interface), `boot.py` (skip-IPL), `state.py` and `state-schema.toml` (L3, L4). ## The import boundary and the sockets - **CPU** (gekko-python): the board gives the core one bus object (60x transactions: kind, physical address, size or burst, data, source, issue tick; the board answers with the completion tick) and the pins (INT, MCP, SRESET, HRESET; the time base clock as bus/4). The core gives `run(until_tick)`, `step()`, pin setters and its state for the shared format. - **DSP** (gcdsp core, proposed): the board gives it its memories' ROM images (player- supplied), an accelerator device (ARAM reads, ADPCM), a DMA device and the mailbox and control registers as its I/O at the top of its data space; the core gives `run(until)`. - **Sockets**: memory card slots A and B (EXI 0/1 device 0); serial port 1 (EXI 0 device 2: BBA, modem); four SI ports (controller, WaveBird, keyboard, bongos, GBA via gba-python); the hi-speed port (Game Boy Player via gba-python); the disc source (image reader). - **Sync points**: domains-and-speed.md ("Sync points"); **memory kinds**: the same page. ## Unknowns (U) and contradictions (C) Unknowns, each with what would settle it (none can be settled without hardware or a tier-3 test whose verdicts were captured on hardware): - U1. Whether PI's interrupt mask gates the Gekko's INT pin (YAGCD 5.4 says it does not). - U2. Open-bus values, unused register offsets, mirrors in the 0x0C00xxxx space. - U3. Main-memory latency and bandwidth seen by a CPU miss, a burst, and each DMA master (1T-SRAM through MI), in ticks; contention between masters. - U4. What each register block does with an access width it does not document. - U5. The latency of an uncached register access from the CPU. - U6. The VI's pixel clock and exact line timings per mode (13.5 MHz assumed). - U7. The EFB's pixel formats bit by bit and the anti-aliasing sample layout. - U8. The EFB copy's filter coefficients, gamma and YUV conversion as the hardware does them. - U9. Whether the vertex cache has any visible effect beyond timing and its invalidate command. - U10. XF's floating-point format and rounding. - U11. The rasteriser's interpolation precision and pixel-centre rules. - U12. TEV's bit widths, the lerp's rounding and the clamping points. - U13. AR_SIZE, AR_MODE and AR_REFRESH meanings (YAGCD "?"). - U14. ARAM DMA speed. - U15. Where streamed audio is ADPCM-decoded (drive or DI) and its exact sample rate. - U16. The drive commands YAGCD lists with "?" fields. - U17. Drive seek and read times (the functional drive's timing is FITTED). - U18. The memory-card unlock exchange (needed only for an LLE card). - U19. Joy-bus bit timing and the controller's response delay. - U20. Whether the AI's "48 kHz" and "32 kHz" are exact (32 kHz does not divide 486 MHz). - U21. Whether the GX's draw time is a function of commands and state alone (the front-end/ back-end split depends on it). Contradictions: - C1. YAGCD 4.1 labels 0x0C005000 "AI"; it holds the DSP mailboxes, DSP control, ARAM DMA and the audio DMA, and YAGCD 5.6 itself calls it the DSP interface. - C2. YAGCD 5.4: PI's cause register "resets to 0, when read", and also follows the source devices, which must be cleared to clear it. - C3. Copetti calls ARAM "SRAM"; YAGCD's parts list names an NEC part, and neither proves the memory type. - C4. YAGCD 2.1: a "200 MHz" bus; its own OS-globals table (4.2) and every other source give 162 MHz. The table wins (it is what the firmware leaves in RAM). - C5. YAGCD 2.1: the Gekko has "a few AltiVec SIMD opcodes added"; the Gekko manual describes paired singles under opcodes 4, 56, 57, 60, 61, not AltiVec. The manual wins. - C6. YAGCD 4.1: "0xE0000000 16k L2 Cache"; that is the locked half of the L1 data cache at an address software chooses through a BAT (Gekko UM 9.2). The manual wins. ## Milestones M1-M8 as in validation.md, each with its exit test. The Python specification never boots a commercial game as a gate case; from M8 on, slices start from states gamecube-rust writes. ## Domains and speed **Domains and channels** (domains-and-speed.md): the CPU domain (Gekko, PI, MI, memory, EXI, SI; the order of record), GX (CP, XF, raster, TEV, PE, EFB), VI, DSP (core, accelerator, DMA), audio out (AI) and the drive. Channels: the GX FIFO ring in RAM, GX register reads, EFB peek/poke, the GPU's RAM reads and its copies' RAM writes; the DSP mailboxes and control, its DMA and ARAM; AI's DMA and stream; DI's commands, DMA and interrupts. One time base: the Gekko's 486 MHz tick (Flipper 3 ticks, DSP 6, time base 12). **The instructions-per-second need, with the arithmetic:** the Gekko retires up to 2 instructions a clock (972 M/s peak); typical game code at IPC 0.4-0.8 (HYPOTHESIS) is 194-389 M/s, 300 M/s as the working figure. Budgets in desktop-equivalent host cycles per instruction at 300 M/s: desktop 5.0e9 / 300e6 = **16.7**, phone app 4.0e9 / 300e6 = **13.3**, phone browser 2.4e9 / 300e6 = **8.0**. An exact interpreter costs 25-60 host cycles with cheap time-keeping (HYPOTHESIS, n64-python) and 89-145 with an SH-2-style scheduler (MEASURED, sh2-rust-fast). The DSP adds 81 M instructions/s (budget 62 / 49 / 30) on its own thread. The pixel pipeline at 37-74 M shaded pixels/s and 200-1,000 host cycles a pixel (HYPOTHESIS) needs 1.5-15 desktop cores in software. **Whether the no-JIT path reaches real time** (`-fast`, then a cached interpreter at 20-50 cycles, then threads at domain channels): | Target | Gekko | DSP | GX | Verdict | | --- | --- | --- | --- | --- | | desktop | 0.33-0.84x | own thread, fits | GPU for typical 3D; software for light scenes | **not real time for typical games**; light titles perhaps; exact idle fast-forward may close the gap in waiting frames | | phone app (iOS: no JIT) | 0.27-0.67x | fits | GPU (Metal) | **not real time**; named concessions needed | | phone browser (wasm recompilation allowed) | 0.16-0.40x | worker, at the edge | WebGPU | **not real time** without wasm recompilation; with it, to measure | The board's stated target with `recompile: none` is therefore **exactness at reduced speed**, said plainly in its capability record; real time comes from turbo (Gekko and DSP recompilation, exact idle fast-forward, the GPU backend under the per-pixel contract), and on iOS native apps only with named concessions (`dsp_hle`, `cpu_cache_off`, `inexact_idle_skip`, `efb_peek_coarse`, `bbox_coarse`, `gx_float_host`, `cpu_timing_cpi`; domains-and-speed.md). **What Python can be:** the definition, the place fixes land, and a runner of test programs and slices (1/200-1/1,000 of real time for the CPU; seconds to a minute per rasterised frame). ## Open decisions for Aubrey (each with my recommendation) 1. **Names**: `gamecube-python` / `gamecube_python`, class `GameCube`; `gekko-python` / `gekko_python`. *Recommend* yes. 2. **Modelling profile**: Gekko at instruction level with transaction-level bus timing and a table-driven core timing model marked FITTED; GX functional per pixel with the FIFO, copies and peeks at transaction level; VI at the cycle of its counters; DSP at instruction level on its own core; the drive functional with FITTED timing; the IPL functional (skip-IPL) judged against the player's IPL. *Recommend* this profile. 3. **The DSP as its own core** (CPU rule; the Wii is its second user): `gcdsp-python` / `gcdsp_python`, class `GCDSP`, with its own Phase 0 before M6. *Recommend* yes. 4. **How the DSP's instruction set is learned.** The only public manual (Duddie's) sits in Dolphin's GPL repository; the Ghidra spec is in Dolphin's lineage. Options: (a) fetch the manual into emu-tools-gpl and read it for facts only (it is documentation; facts are not code), tagging each fact with its source; (b) derive the ISA without it (patents, running ucode in Dolphin as a closed box). *Recommend* (a), with the manual never entering an MIT repository and nothing copied from its text. 5. **The DSP's ROMs.** *Recommend* player-supplied ROMs found by SHA-1 (both present on this machine) for LLE now; a clean-room IROM of our own later (as Cult-of-GBA's BIOS was for the GBA); Dolphin's GPL free IROM only as a closed-box comparison from emu-tools-gpl. 6. **Disc images.** The set is NKit RVZ. *Recommend* the board read plain ISO/GCM through its disc-source interface, with conversion done by Dolphin's own tool run from emu-tools-gpl (running a GPL tool is fine), outputs kept outside every repository; an MIT RVZ reader written from the format's description to be decided later, since that description lives in Dolphin's GPL repository. 7. **Fetch the GameCube patents** (public, tier 2; YAGCD 19 lists about 25) into `reference/patents/` after checking the host's robots.txt. *Recommend* yes, before M4: they are the only designer-written description of GX in reach. 8. **The `recompile: none` statement** ("exactness at reduced speed") in the capability record, with real time from turbo and GPU backends. *Recommend* yes; and no `-fast` or turbo work before M5 exits, so the specification is shaped by the hardware, not by speed. 9. **Shared state format from M1** (late-era L3, L4: a schema file here, hand-written encoders in each tier). *Recommend* yes, as for n64-python and psx-python. 10. **GBA link and Game Boy Player** as sockets pinning gba-python. *Recommend* after M7. 11. **Test programs**: a small Python assembler in `tests/` producing our own DOLs (no devkitPro libraries, gekko-python decision 9); GNU binutils for PowerPC, run as a tool, for anything larger. *Recommend* yes. 12. **hwtests through the closed-box route** (built with a PowerPC toolchain and libogc in emu-tools-gpl, run on the board through a harness, pass/fail read). *Recommend* yes if decision 9 of gekko-python allows libogc in emu-tools-gpl; otherwise skip. 13. **Triforce** as a separate board pinning gamecube-python (media board, JVS), much later. *Recommend* deferring it past M8. 14. **Local until M4, then public** after a provenance check (nothing from GPL sources, no Nintendo code or firmware), with the family's minimal CI. *Recommend*. ## What was not verified in this phase (candour) - No program ran on any GameCube emulator; MAME's driver does not start. Every board fact is from YAGCD or Copetti (tier 3) or from the Gekko manual (tier 2, CPU side only). - YAGCD's chapter 5 is long tables; facts used here were read at the cited sections, not transcribed in full. Register bit layouts are to be transcribed with section numbers at each milestone. - The patents and the leaked SDK documents were not fetched; Dolphin was not built or run. - All speed figures are HYPOTHESIS with arithmetic shown, except the SH-2 yardstick (MEASURED in sh2-rust-fast) and pureikyubu's own numbers (OBSERVED). - The census read 0x80 bytes per disc; no image's SHA-1 was checked against Redump.