# Handoff: build `xbox-python`, the original Xbox board ## Context you are inheriting Chips are cores, boards compose cores; the board pins its cores by commit. The CPU core is `x86-p3-python` (`../x86-p3-python`, Phase 0 done the same night; its brief proposes the bus contract this board implements). The board finds the core's corners and raises them there. This machine is past the charter's era 3 in everything but its date: a 733 MHz out-of-order CPU, a programmable GPU with no public documentation, two DSPs, and a firmware chain built on keys. Read, before code: the late-era method proposal (`../emulator-lineage/docs/proposals/2026-11-late-era-method.md`: slices, x-rust as the first runnable tier, a shared state format), the N64's execution architecture (`../n64-python/docs/execution-architecture.md`: time as data, the front/back split, the hazard map, GPU backends), and the JIT proposal (`../emulator-lineage/docs/proposals/ 2026-11-jit.md`). Nearest models in the family: `n64-python` (unified memory, a GPU split into a timing front end and a pixel back end, Phase 0 last night), `psx-python` (a disc board with `REDUMP_DIR`, catch-up at the channel), `sega32x-python` (domains as code), `dreamcast-python` (a PowerVR GPU and a sound DSP, Phase 0 tonight). Rules: Python >= 3.11, CPython and PyPy; MIT; nothing read from GPL emulators (xemu, Cxbx-Reloaded, XQEMU) or GPL tools; MAME closed; no firmware, keys, EEPROM, HDD image, disc or MAME trace in the repository (firmware-and-secrets.md); `MAME_ROMPATH`, `XBOX_FIRMWARE_DIR`, `REDUMP_DIR`; local git only; no sweeps, ever, in Python. ### Read in this order README.md; docs/start-here.md; docs/domains-and-speed.md; docs/kernel-hle-lle.md; docs/firmware-and-secrets.md; docs/memory-map-pci.md; docs/nv2a.md; docs/mcpx-apu.md; docs/smbus-devices.md; docs/storage.md; docs/census.md; docs/validation.md; docs/mame-oracle.md; then x86-p3-python's handoff-brief.md (the bus contract), and the pinned xboxdevwiki pages for the milestone at hand (`python -I scripts/fetch_wiki.py`). ## Scope In: RAM and the NV2A's memory controller; the NV2A's host bridge, PMC, PTIMER, PFIFO, PGRAPH (Kelvin), the vertex shader, the rasteriser and combiners, PCRTC; the MCPX's PCI devices, legacy PC block, SMBus controller, USB (OHCI) with the controller and memory unit, IDE with the hard disk (ATA security) and the DVD drive (ATAPI with the authentication page), the APU (VP, GP and EP through a DSP core, ACI), the flash and the boot-ROM overlay with its hide bit; the SMBus devices (SMC high-level, EEPROM, video encoders, temperature monitor); disc images (Redump layout, XISO); the test-program loader. Out: the CPU core (x86-p3-python); the DSP core (decision X6); network beyond a stub; Chihiro; development kits (128 MB, no MCPX ROM, Super I/O); an HLE kernel. ## Proposed names - Package **`xbox_python`**; `xbox_python.Xbox` (the board), constructed with a `revision` (`"1.0"` ... `"1.6"`: selects MCPX ROM 1.0/1.1, flash size, video encoder, temperature monitor, SMC revision) and the player's files by path. - Modules: `bus.py` (decode, PCI configuration, the ROM overlay), `nv2a/` (`pmc.py`, `ptimer.py`, `pfifo.py`, `pgraph.py`, `vsh.py`, `raster.py`, `combiners.py`, `pcrtc.py`, `hazards.py`), `mcpx/` (`legacy.py`, `smbus.py`, `usb.py`, `ide.py`, `apu/` (`vp.py`, `dsp_glue.py`, `aci.py`), `nic.py`), `devices/` (`smc.py`, `eeprom.py`, `encoder.py`, `adm1032.py`, `hdd.py`, `dvd.py`, `controller.py`), `media/` (`redump.py`, `xiso.py`, `xdvdfs.py`, `fatx.py`), `loader.py` (test programs), `domains.py`, `state.py` (the shared schema of L3), `machine.py`. - Sockets: the CPU (x86-p3-python's bus contract), the DSPs (a `Dsp` protocol), the USB ports (a `UsbDevice` protocol), the IDE devices, the A/V pack. ## Import boundary The board imports `x86_p3_python` and, once it exists, the DSP core, and nothing else of the family's. The cores never import the board. ## Unknowns (U) and contradictions (C) - U1 NV2A timing of everything (no document): FITTED. - U2 Whether the NV2A really uses NV_texture_shader's 8/9/16-bit fixed-point types in its combiners ("not known": `Pixel Combiner`). - U3 The clock tree: the RAM's clock, the DSPs' 160 MHz, which clocks derive from the front-side bus (domains-and-speed.md). - U4 DMA coherence with the CPU's caches (x86-p3-python U8). - U5 What the retail kernel does with a drive whose ATA security is not enabled. - U6 The SMC's behaviour beyond the register list; the challenge's exact timing. - U7 The APU DSPs' identity (Parthus MediaStream "probably"; DSP56300-like) and their clock; the DSP DMA fields marked "?". - U8 The VP's envelope curves and filter arithmetic ("best approximation" on the wiki). - U9 Which XISO offset maps onto the Redump layout's game partition. - U10 The PIT's frequency on the Xbox (a HOWTO page not pinned tonight). - U11 The read-time EEPROM section checksum's source (unattributed on the wiki). - U12 FATX directory format (on pages the wiki links, not pinned). - C1 nxdk's README credits OpenXDK as MIT; XboxDev/OpenXDK's repository is GPL-2.0. Matters only if code from nxdk's OpenXDK-derived files is ever taken (we take none). - C2 MAME has kernel 4134; Redump's BIOS set does not; the wiki doubts it is a real Microsoft release. MAME boots it (x86-p3-python mame-oracle.md). - C3 `Xbox Hardware Overview` calls the RAM 133 MHz; the parts' grade is 200 MHz DDR. - C4 The APU's voice count: 256 vs 64 (two sources on `APU`). ## Milestones M1-M9 as validation.md's ladder: bus and boot ROM phase (MAME as detector); the test-program loader (abaire's programs in CI without firmware); the NV2A front end; the software rasteriser and vertex shader against the golden pictures; the LLE boot with the player's firmware; the DVD drive and discs (first title frame in x-rust); the APU; the timing pass; seeded faults. ## Domains and speed (Full version: domains-and-speed.md.) **Domains and channels.** CPU domain (the core, the memory controller's arbitration, PCI, legacy devices, SMBus and its devices, the flash and ROM overlay); GPU front end (PFIFO, PGRAPH state, vertex shader, PCRTC: inline on the CPU thread or ahead with rollback); GPU back end (producer, joined through a RAM hazard map); APU VP, GP DSP, EP DSP, ACI (frame-synchronous at 1,500 Hz, producers); USB and IDE (inline). Channels: UC/WC MMIO, push buffers, vertex buffers, textures, surfaces, semaphores and notifiers in RAM, DSP FIFOs and scratch in RAM, interrupts. **Instructions per second, with arithmetic.** CPU: 733.33 MHz x IPC 0.55-1.0 = **400-730 M instructions/s** (HYPOTHESIS; MAME's model: 20,461,122 instructions in 1/30 s = 614 M/s, OBSERVED). Desktop budget 5.0e9 / R = **6.8-12.5 host cycles per instruction**; phone app 5.5-10.0; phone browser 3.3-6.0. Exact interpreter: 25-60 (HYPOTHESIS, against the SH-2 yardstick of 89-145, MEASURED in sh2-rust-fast). Pixels: 18-74 M/s at 300-1,500 host cycles each in software = 1-20 desktop cores. DSPs: 100-260 M instructions/s together at 20-40 cycles = 1-2 cores. VP: 12.3 M voice-samples /s, under half a core. **Does the no-JIT path (Rust -fast, then a cached interpreter, then threads at domain channels) reach real time?** | Target | Verdict | | --- | --- | | Desktop | **No.** The CPU misses by 2-9x; a cached interpreter gains perhaps x1.5-2; threads move the GPU back end, VP and DSPs off the CPU's core but cannot split the CPU. Real time needs turbo: native recompilation or virtualisation (X1) plus a GPU backend. | | Phone app | **No.** iPhone: no executable memory, so no recompiler and no hypervisor: out of reach. Android: recompilation allowed; at the edge on flagship phones (HYPOTHESIS, unmeasured). | | Phone browser | **No.** x86-to-wasm at several hundred M instructions/s beside WebGPU work: out of reach. | So the honest statement for the capability record: **`recompile: none` reaches real time on no target for commercial titles.** The specification and x-rust run test programs and slices; playing is turbo on desktops. ## Open decisions for Aubrey - **X1. Is the Xbox a family board at all, and in what form?** *Recommended*: yes, as a specification (x-python, judged on test programs and slices) and a transcription (x-rust, the first tier that boots titles), with turbo (native recompilation and a GPU backend) as the only playable form, desktop only, said plainly in the README and the capability record. Hardware virtualisation (KVM/HVF/WHPX) as a turbo backend is a charter question: it is not in the capability list, it exists only on x86 hosts, and it gives up per-instruction determinism unless interrupts are delivered only at controlled exits. *Recommended*: native recompilation first; virtualisation recorded as a candidate concession, not built, until recompilation is measured. - **X2. Kernel: LLE as the specification; a test-program loader with stub exports for firmware-free gate cases; no HLE kernel planned** (kernel-hle-lle.md). Gate states made after a firmware boot hold decrypted kernel memory, so they are firmware too: regenerated from the player's files, never committed. *Recommended* as written. - **X3. Disc authentication without the security sectors.** Redump's zips hold no SS. *Recommended*: the drive model needs the player's SS file beside the image; a drive that reports "authenticated" without it is a named concession, off by default. - **X4. The HDD image.** Microsoft's dashboard is not ours. *Recommended*: the board formats an empty FATX disk itself (our own MIT code, from the wiki's facts) for test programs; a player's own image for the dashboard; mborgerson's unlicensed dummy image not used. - **X5. The SMC (PIC16LC) at high level.** Its firmware is Microsoft's and not public. *Recommended*: register-level HLE, the boot challenge answered by the kernel's own code path and the PIC's side modelled as accepting it, recorded as HYPOTHESIS. - **X6. A DSP core for the APU.** The DSPs are CPU-class (they run uploaded code), so the chip rule gives them their own core. Their identity is a HYPOTHESIS (DSP56300-like Parthus core). *Recommended*: a Phase 0 for `dsp56300-python` (or a name chosen after the identity is settled), starting from NXP's DSP56300 Family Manual after its terms are checked; until then the board runs without APU DSPs (silence), recorded. - **X7. Khronos and other partial AI-crawler blocks.** registry.khronos.org blocks CCBot, PerplexityBot, Google-Extended and others but not ClaudeBot by name. *Asked*: does a partial AI block count as the site's wishes? Tonight it was treated as if it did (not fetched; NVIDIA's own copies used). - **X8. NVIDIA's public nForce material** (the MCP APU technical brief, the nForce datasheets if any). *Recommended*: look for NVIDIA-hosted copies in the build session, check robots.txt first, pin as tier 2 for the PC sibling. - **X9. Network as a stub** (no link). *Recommended*: yes until a milestone needs system link. - **X10. MAME's BSD-3-Clause Xbox files stay closed.** *Recommended*: closed (its driver is preliminary; the golden pictures and tests judge better). - **X11. Default provisional choices** (2026-11-12 rule): RAM at 200 MHz (C3), 256 voices (C4), DSPs at 160 MHz (U3), no DMA snooping (U4), unlocked ATA security accepted by the kernel (U5). Each marked HYPOTHESIS in code.