# Handoff: build `n3ds-python`, the Nintendo 3DS board (New 3DS as a row) ## Context you are inheriting The 3DS is an **era 3** board in the charter's sense and beyond it: three ARM generations (an ARM11 MPCore with 2 or 4 CPUs, an ARM9, and for legacy modes an ARM7), a Teak DSP, a partly documented GPU, and an operating system without which no game runs. Before anything else read [firmware-and-keys.md](firmware-and-keys.md) (what we will never hold, and the HLE/LLE boundary) and [execution-architecture.md](execution-architecture.md) (domains, channels, and the honest speed numbers); then the emulator-lineage proposal `docs/proposals/2026-11-late-era-method.md` (slices, x-rust as the first runnable tier, the shared state format), whose decisions this board depends on. Cores: **arm11-python** (`../arm11-python`, Phase 0 tonight), **arm946es-python** (`../arm946es-python`, Phase 0 2026-11-26, needs a 3DS row), **arm7tdmi-python** (`../arm7tdmi-python`, built; legacy modes only), **teak-python** (proposed; shared with nds-python's DSi row). Models: n64-python and psx-python (era-3 Phase 0s with execution-architecture documents), nds-python (the DS board and its DSi row: the legacy mode's machine), gameboy-python (the skip-boot discipline: the 3DS's FIRM side-load is the same question). Rules that bind: the charter and CLAUDE.md (MIT; Citra and its forks, Panda3DS, Mikage and MAME are never read or fetched here); Nintendo's boot ROMs, OS, system titles, DSP program, MCU and Wi-Fi firmware and every key are never shipped, copied or read, and identified by SHA-1 only; 3dbrew is set aside for its site's wishes; oracle tiers; Python 3.11 floor, PyPy green; no hardware probes; run anything reading `reference/` with `python -I`. ## Scope (first build) The Old 3DS row: memory map and machine rows; CONFIG9/CONFIG11; PXI; the interrupt controllers' sources; ARM9 and ARM11 timers; NDMA, XDMA and CDMA (the DMA-330s); HID, GPIO, SPI (TSC: touch and Circle Pad), I2C with the gyroscope and the MCU's register file (functional); LCD timing and framebuffer scan-out; the GPU's external engines and the PICA200; AES, SHA, RSA, PRNG engines (no keys); SD/eMMC controllers against player images; CSND; the APBP window to teak-python; a FIRM side-loader. Then the New 3DS row (four ARM11 CPUs, clock modes, L2C-310, extra memories, L2B/MVD, the second CDMA, C-stick, ZL/ZR, new gyroscope). Then the HLE OS (decision K1). Later: cameras (a socket), NFC, IrDA and the Circle Pad Pro, Wi-Fi, legacy GBA/DS/DSi modes (decision N5), the LLE firmware path as an option for players who have their own. ## Proposed names - `n3ds-python`, package `n3ds_python`; class `N3DS` with a machine row (`MachineRow(model="o3ds"|"n3ds", ...)`: memory-map.md's rows). - Packages: `bus` (the ARM11 and ARM9 maps, the AXI interconnect, data-abort pages), `config` (CONFIG9, CONFIG11), `pxi`, `irq9`, `timers9`, `dma` (`ndma`, `dma330`), `hid`, `gpio`, `spi` (`tsc`), `i2c` (`mcu`, `gyro`, `lcdctl`, ...), `lcd`, `gpu` (`external`, `pica`: `command`, `vertex`, `shader`, `raster`, `texture`, `combiner`, `lighting`, `framebuffer`), `crypto` (`aes`, `sha`, `rsa`, `prng`, `otp`), `storage` (`sdmmc`, `ctrcard`, `spicard`), `csnd`, `dsp` (the APBP side), `firm` (the side-loader), `hle` (decision K1: the OS model, imported by nothing in the hardware packages). ## The import boundary - **arm11-python** owns the whole MPCore macrocell, including the private region at 17E00000h; it issues AXI-like transactions with a CPU id and the board answers with data and a duration; the board drives distributor lines 20h-7Fh (arm11-python handoff-brief). - **arm946es-python** (3DS row) owns the ARM9's caches, TCMs and protection unit and issues BIU transactions; the board answers them and drives its IRQ line from IRQ_IE/IRQ_IF. - **teak-python** owns the DSP and its internal peripherals; the board owns the ARM-side APBP registers, the fixed DSP memory mapping and the BTDMP audio sink. - **The GPU, the DMA engines, the crypto engines and every peripheral stay in the board.** Chip rule: none has a second family user (the PICA200 appears only in the 3DS family); the DMA-330 is an ARM part that could one day be shared, but no other family board uses it yet. ## Reuse first: the family's existing cores, chip by chip | 3DS part | Existing family core or board | What it would need | | --- | --- | --- | | ARM11 MPCore | none (arm7tdmi-python and arm946es-python are other generations) | a new core: arm11-python (its core-choice.md) | | ARM9 | arm946es-python (Phase 0) | a 3DS configuration row (cache/TCM sizes, clock ratio, IDs: U1); no new instructions | | ARM7 (legacy modes) | arm7tdmi-python (built) | nothing; the board starts it from ARM7_BOOTCODE | | Teak DSP | none; nds-python's DSi row also needs it | a new core, teak-python, shared by both boards (N3) | | CSND sound | nds-python's DS sound (in that board, docs/sound.md): GBATEK says CSND "works very similar to NDS sound" with twice the channels and simpler volume | a second user of a DS-sound-like block: **no extraction yet** (neither board is built); write CSND in this board citing nds-python's sound.md, and propose an extraction when both exist (chip rule) | | TSC (touch, Circle Pad), DSi cameras, I2C bus 0 devices, NDMA | nds-python's DSi row (docs/dsi.md: same TSC lineage, Aptina cameras, NDMA) | the same: in each board for now, extraction proposed when both are built | | DMA-330 (XDMA, CDMA) | none | in the board; an ARM part, extractable if another family board ever uses one | | PICA200, MCU, crypto engines, LCD, Y2R/L2B/MVD/LGYFB | none | in the board (one machine) | | Legacy GBA/DS/DSi machines | gba-python, nds-python | composed behind the legacy socket (N5) | ## Sockets - The legacy-mode machine (ARM7_CNT, CFG11_TWLMODE_*, LGYFB): a later socket for an nds-python/gba-python composition (decision N5). - Cartridge: a decrypted-image source (HLE) or a card-protocol device (LLE, player's keys). - Camera images, the NFC tag, the IR accessory, Wi-Fi: devices behind sockets. - The player-supplied firmware path: boot ROMs, OTP, NAND, key file (never ours). ## Domains, channels, sync points As [execution-architecture.md](execution-architecture.md): the ARM11 domain (MPCore, its bus, the GPU front end, LCD timing) leads; the ARM9, the DSP, the GPU back end, scan-out, CSND and the slow peripherals are the other domains; PXI, shared FCRAM/AXI WRAM pages, shared I/O, APBP, DSP memory, AHBM and the interrupt lines are the channels; one integer time base of 1/24 of the 67.027964 MHz period. ## Domains and speed - **Domains and channels**: above. - **Instructions per second needed** (HYPOTHESIS, arithmetic in execution-architecture.md): ARM11 CPU0 about 160 M/s (134-215 M: 268.11 MHz x 0.5-0.8 IPC), CPU1 15-50 M/s (about 0 under HLE), New 3DS titles about 480 M/s per busy CPU at 804 MHz; ARM9 5-30 M/s (about 0 under HLE); Teak 40-100 M/s; PICA200 5-50 M shader instructions/s and 20-60 M fragments/s. - **Budgets** (desktop 5.0e9, phone app 4.0e9, browser 2.4e9 host cycles/s): ARM11 CPU0 31 / 25 / 15 cycles per instruction; New 3DS 10 / 8 / 5; fragments 83-250 / 67-200 / 40-120 cycles each against a likely 300-1,000 in software. - **Does the no-JIT path reach real time?** Desktop: at the edge for Old 3DS titles (the ARM11 interpreter must reach about 25-31 host cycles per instruction, against 126-146 measured for arm7tdmi-rust), with the GPU on threads or the host GPU and the DSP on its own thread or in HLE; New 3DS 804 MHz titles: no. Phone app: no for busy titles. Browser: no without `recompile: wasm` and WebGPU. The capability record must say so. ## Unknowns (U) and contradictions (C) Unknowns (and what would settle each): - U1. The 3DS ARM9's identity and configuration (CP15 main ID, cache type, TCM sizes) and clock: a payload that reads CP15 and times a loop against the 67 MHz timers. - U2. The state the boot ROMs leave for a FIRM (CONFIG9/11, clocks, PXI, keyslots filled, MMU/MPU, caches): a payload that dumps its first state; until then our documented choice. - U3. The ARM11's L1 cache sizes and revision (arm11-python U1/U2). - U4. The GPU's clock (268 MHz is the community figure, not GBATEK's). - U5. The PXI FIFO depth (GBATEK: "seem to be exactly same as on NDS", 16 words). - U6. Three images in the decrypted set (CTR Eva and two SystemUpdater dumps) whose NCCH says NoCrypto but whose ExeFS header is not in the clear (census.md). - U7. The memory system's timing: FCRAM, VRAM, AXI WRAM and DSP memory latencies, bus contention between the ARM11s, the ARM9, the GPU and DMA. No source found. - U8. Peripheral timing: SDMMC, I2C and SPI transfer times, DMA rates, the crypto engines' block times (GBATEK gives RSA examples only). - U9. Float24 arithmetic in the shader units: rounding, denormals, infinities, NaNs. - U10. EX2, LG2, RCP, RSQ, LITP precision and exact results. - U11. The rasteriser's fixed-point steps, fill rules, interpolation precision, texture filtering and LOD arithmetic, combiner precision, the lighting LUT interpolation. - U12. Whether the PICA200's completion times are a function of the commands and memory alone (needed for the exact front/back split). - U13. The geometry shader and the primitive engine ("not yet understood": GBATEK); what the two "Unknown purpose" shader register sets are. - U14. Teak instruction timing (teakra: most instructions one cycle). - U15. The DSP program's busy fraction and its shared-memory protocol (for the HLE). - U16. The MCU's register behaviour beyond GBATEK's description. - U17. What the camera sensors return under each I2C setting (a functional model suffices). - U18. The HLE OS's timings: how long each service takes, when each event signals. - U19. Which system archives games need (the shared font, the CFG save, Mii data) and where a free replacement comes from. Contradictions: - C1. The DSP architecture: TeakLite II (GBATEK) against the original Teak (teakra's README, from Lauterbach's register sets). Both decode the same programs. - C2. NCCH byte 18Ch is "02h=Snake=New3DS" by GBATEK, but all 11 images of No-Intro's "New Nintendo 3DS (Decrypted)" set carry 01h; their New 3DS requirement shows in the exheader's Flag1/Flag2 instead (census.md). - C3. GBATEK says the 3DS has four shader units with their own ports; it reports 3dbrew as documenting two (GSH and VSH). We cannot check 3dbrew (set aside). - C4. GBATEK marks ARM11 00000000h "also ITCM in ARM11 ?"; the MPCore TRM's ID_MMFR0 says no TCM (arm11-python C1). - C5. U6's three images: NoCrypto set, ExeFS not in the clear. ## Milestones M1-M8 with exit tests: [validation.md](validation.md). Python never boots a commercial title as a gate; M8's slices start from Rust-tier states (late-era proposal, L1-L3). ## Open decisions for Aubrey (each with my recommendation) 1. **N1. 3dbrew set aside (site's wishes)**: its robots.txt sets no AI signal, but its Cloudflare layer answered our API requests with 403 "blocked". *Recommend* treating it as set aside, as the brief's rule says for anti-bot walls; Aubrey may read it himself, or ask its operators whether a slow, identified fetch of pinned revisions would be welcome. 2. **K1. HLE of the OS, LLE of the hardware**, the player's firmware as an optional judge only. *Recommend* yes, with the OS model as a package (`n3ds_python.hle`) that no hardware package imports, and its claims worded as "the titles on the slice list run", never "behaves as Horizon". 3. **K2. No container decryption in the board**: decrypted dumps (all of No-Intro's cartridge images) only; encrypted media only through the player-supplied LLE path. *Recommend* yes. 4. **K3. The key-scrambler constants stay out of the repository** although GBATEK publishes them; the AES engine takes them with the player's keys. *Recommend* yes (they are Nintendo's secrets; publication elsewhere does not change what we ship). 5. **N2. Names**: `n3ds-python` / `n3ds_python`, class `N3DS`, machine rows `o3ds`/`n3ds`. *Recommend* yes. 6. **N3. `teak-python` as its own core**, shared by nds-python's DSi row and this board; fetch teakra's hardware results (a 357 MB Git LFS object) when it starts, through git-lfs or the LFS batch API. *Recommend* yes. 7. **N4. DSP HLE** (a functional model of Nintendo's audio program) as a named concession in the turbo tier, judged against teak-python running the player's DSP program where a player has it. *Recommend* yes; LLE remains the specification. 8. **N5. Legacy modes (GBA, DS, DSi) late**, as a socket composing gba-python/nds-python behind ARM7_CNT and LGYFB. *Recommend* after M8. 9. **N6. Facts that reached GBATEK's Teak chapters through leaked documents** (a DSP Group specification, an RVDS DLL). *Recommend* citing them only through GBATEK, preferring teakra's hardware-captured results wherever they decide the same question, and never fetching the leaked documents. 10. **N7. The MCU as a functional register-file model**, no RL78 core. *Recommend* yes. 11. **N8. The FIRM side-load start state** chosen and documented by us (provisional) until a console dump exists. *Recommend* yes, with every verdict under it marked "side-load". 12. **N9. A 3DS probe list** in PROBE-QUEUE.md, should Aubrey ever have a 3DS (he has none now): CP15 reads, start-state dump, float24 tests, the hardware-test repositories' runs. *Recommend* writing the list now, running nothing. 13. **N10. Gate without sweeps**: test programs and a slice list from Rust-tier states; no Python library sweep ever. *Recommend* yes (the late-era proposal's L1). 14. **N11. The shared state format from M1** (late-era L3/L4), so slices can be transplanted. *Recommend* yes. 15. **N12. The GPU backend as turbo**, proven per pixel and per device, with float24 reproduced or its differences named. *Recommend* yes (late-era L6). 16. **N13. Local until M2**, then public after a provenance check. *Recommend* yes. ## What was not verified in this phase (candour) - 3dbrew was not read at all (set aside); the 3DS knowledge here is GBATEK's, ARM's and teakra's. GBATEK's 3DS sections were read where cited, not end to end. - No homebrew was built (no devkitARM here) and no test was run; no console verdict was captured by us or found published except teakra's (not fetched). - Every clock multiplier but the 67.027964 MHz base and the CONFIG11 modes is HYPOTHESIS. - All speed figures are HYPOTHESIS with arithmetic shown; the measured yardsticks are other family cores'. - The census reads headers only; "decrypted" is the NoCrypto flag plus ".code" in the clear.