# The DSP, ARAM and the audio interface Sources: YAGCD 5.6 and 5.10 (community, facts only, tier 3); Copetti's "Audio" section (CC BY 4.0, secondary). The DSP's instruction set is not documented in any source this phase fetched: the one public manual (Duddie's "GameCube DSP User's Manual") lives in Dolphin's GPL-2.0-or-later repository and is not fetched under the closed-box rule; Pokechu22's Ghidra SLEIGH specification (Apache-2.0) says it was written with Dolphin's tables and interpreter as references, so its encodings are facts in a GPL lineage (facts only, not fetched; open decision 4). ## The DSP (YAGCD 5.6; DOC, community) - A custom 16-bit DSP inside Flipper, made by Macronix (Copetti), clocked at **81 MHz** (162/2), with 16-bit data words and addressing; 4K words (8 KB) of instruction RAM and 4K words (8 KB) of instruction ROM; 4K words (8 KB) of data RAM and 2K words (4 KB) of data ROM (the "coefficient" ROM); 40-bit multiply-accumulate results; a hardware ADPCM decoder; a cached interface to ARAM (the "accelerator"); DMA to main memory; mailboxes to the CPU. - Its internal control registers sit at the top of its data space (YAGCD lists, for example, ACCAL at 0xFFD9 and the ARAM DMA mask AMDM at 0xFFEF). - **It runs programs ("ucode") that each game uploads.** After a reset the DSP runs its instruction ROM, which talks to the CPU through the mailboxes; YAGCD 5.6.2.4 gives the mail sequence by which the CPU tells it where in main memory a task's ucode and data are (0x80F3A001 + address, 0x80F3C002 + IRAM address, 0x80F3A002 + length, 0x80F3B002 + ARAM address, 0x80F3D001 + start vector). Games ship different ucode families (an "AX" mixer and others; HYPOTHESIS from the community's names, not verified here), and special ucodes run for memory-card unlock and for the GBA link's handshake (HYPOTHESIS). - **The CPU rule applies: the DSP is a programmable processor, so it gets its own core.** It also has a second family user: the Wii's DSP (HYPOTHESIS: the same core in Hollywood; the Wii Phase 0 will check). Proposed: `gcdsp-python` (package `gcdsp_python`, class `GCDSP`), a later Phase 0 of its own (open decision 3). Reuse checked first: the family's DSP cores are dsp16-python (AT&T DSP16, the QSound DSP: a different ISA), ssp1601-python (Samsung's SVP DSP: a different ISA), s-dsp-python (the SNES's sound DSP: not programmable) and jrisc-python (Jaguar RISC). None fits; no socket or variant would. ### The two ways to run it | Way | Level | Needs | Standing | | --- | --- | --- | --- | | **LLE**: run the uploaded ucode on the DSP core | instruction (and the board's cycle of its DMA and accelerator) | the DSP's instruction ROM and coefficient ROM: Nintendo firmware, player-supplied (ipl-firmware.md: SHA-1s 3c6cc6e0 and c116d867, both present on this machine via MAME's sets) | the specification's way: it runs what the hardware runs | | **HLE**: recognise the ucode and do its job in native code | functional | nothing of Nintendo's, but one implementation per ucode family | a **named concession** (charter): changes timing of the mailboxes and DMA, and the mixing arithmetic; off by default | A free replacement for the instruction ROM exists in Dolphin (GPL; its README of the Ghidra spec calls it "Dolphin's free DSP rom"). It is GPL code and cannot enter an MIT repository; whether a closed-box use of it (built and run from emu-tools-gpl) or our own clean-room IROM is wanted is open decision 5. Until then the board runs LLE only with the player's own ROM images, found by SHA-1. ### Domains The DSP is its own clock domain (81 MHz) and meets the rest only at channels: the two mailboxes (each 31 bits plus a full flag, written as two 16-bit halves), the DSP control register's interrupt and reset bits, its DMA into main memory, the accelerator's ARAM reads and the AI DMA's sample stream (domains-and-speed.md). Running it on its own thread is therefore possible from `-fast` on; mailbox polling makes the CPU-side synchronisation dense at times (execution-architecture.md). ## ARAM (YAGCD 5.6; Copetti) - 16 MB (an NEC part, YAGCD 2.4.2) on an 8-bit, 81 MHz bus to Flipper; **no CPU address reaches it**. Software moves data with the ARAM DMA (AR_DMA_MMADDR, AR_DMA_ARADDR, AR_DMA_CNT at 0x0C005020-2A; direction in the count's high bit; completion in the DSP control register's ARAM interrupt bit), and the DSP's accelerator reads it while mixing. AR_SIZE, AR_MODE and AR_REFRESH configure it (0x0C005012-1A; their meaning is partly "?" in YAGCD: U13). - Games use ARAM for samples and as a second-level store for anything (Copetti: "general use"); a few are said to page main memory to it through the MMU (gekko-python mmu-exceptions.md; HYPOTHESIS). - The ARAM DMA's speed is a timing unknown (U14): bytes per bus cycle at 81 MHz x 8 bits is an upper bound of 81 MB/s. ## The audio interface (AI; YAGCD 5.6, 5.10) - **AID, the DMA path**: the CPU points the audio DMA (0x0C005030-36: start address, length in 32-byte blocks, enable) at a buffer the DSP mixed; the AI plays it at 32 kHz or 48 kHz (AICR's rate bits) and interrupts when it starts a buffer (DSP control's AID interrupt). - **AIS, the streaming path**: audio streamed from the disc by the DVD drive (ADPCM decoded in the drive or DI: U15), mixed with AID, with its own volume (AIVR), a sample counter (AISCNT) and an interrupt at a programmed sample count (AIIT) (YAGCD 5.10). - 1,628 of the 2,014 images in the census set the disc header's streaming flag (census.md), so the AIS path matters to most titles' boot even if far fewer stream music (HYPOTHESIS: the flag may be an SDK default). - What the player hears is the observable contract's audio output: the specification defines it as the AI's sample stream at its own clock.