Skip to main content
The GameCube and Wii DSP (Digital Signal Processor) is responsible for audio processing and other signal processing tasks. Dolphin provides multiple approaches to DSP emulation, including a legal replacement ROM and interpreter implementations.

DSP Overview

The DSP is a specialized processor that handles:
  • Audio mixing and effects processing
  • Microcode (UCode) execution for different audio systems
  • DMA transfers between main memory and DSP memory
  • Communication with the CPU via mailbox system

CPU-DSP Communication

The CPU communicates with the DSP through a mailbox system. Here’s the typical communication pattern:

DSPSendCommands2 Function

This is a typical CPU-side function for sending commands to the DSP:
void DSPSendCommands2(_pBuffer, _NumberOfMessages, _StartWork)
{
    // Wait for DSP to be running
    while (!DSP_Running_Check());
    
    OldInterrupts = OSDisableInterrupts();

    // Check if DSP mailbox is ready
    if (DSPCheckMailToDSP() != 0)
    {
        OSRestoreInterrupts();
        return -1;
    }

    // Send number of messages
    DSPSendMailToDSP(_NumberOfMessages)
    
    // Trigger DSP interrupt
    DSPAssertInt()

    // Wait for mailbox to be ready
    while (DSPCheckMailToDSP() != 0) {}

    if (_NumberOfMessages == 0)
        _NumberOfMessages = 1

    // Optional: Start work
    if (_StartWork != 0)
    {
        r28 = DSPStartWork(*_pBuffer, _StartWork)
    }
    _StartWork = 0

    // Send all messages in buffer
    while(Count != _NumberOfMessages)
    {
        DSPSendMailToDSP(Buffer[Count])
        while (DSPCheckMailToDSP() != 0) {}
        Count++
    }

    OSRestoreInterrupts(OldInterrupts)

    return r28;
}

Communication Flow

  1. Initialization: CPU waits for DSP to be ready
  2. Message Count: CPU sends the number of messages to transmit
  3. Interrupt: CPU triggers DSP interrupt to signal new data
  4. Message Transfer: CPU sends each message and waits for acknowledgment
  5. Completion: Interrupts are restored and control returns
All DSP communication operations require disabling interrupts to ensure atomic mailbox operations.
Dolphin includes a legal replacement for the proprietary GameCube/Wii DSP IROM and DROM (coefficient ROM). This allows Dolphin to emulate DSP functionality without requiring copyrighted ROM dumps.

Version History

Date: August 17, 2021
Authors: Tilka, Pokechu22
Changes:
  • Minor accuracy and documentation improvements
  • Removed use of SRS instruction with AX registers (instructions don’t actually exist)
Date: August 10, 2017
Author: ligfx
Changes:
  • When running from ROM entrypoint, skip bootucode_ax branch
  • Prevents bad DMA transfers and crashes since ROM doesn’t set AX registers
Date: June 2, 2017
Author: ligfx
Changes:
  • Explicitly set 23 coefficient values used by GBA UCode
  • Tweaked parameters to match those 23 values more closely
  • Moved functions to proper places
  • Updated BootUCode to configure DMA using both AX and IX registers
  • Added partial functions used by GBA UCode
Date: June 29, 2015
Author: stgn
Changes:
  • COEF: 4-tap polyphase FIR filters
  • IROM: Unchanged
  • Coefficients roughly equivalent to official DROM
  • Greatly improved resampling quality over linear interpolation
Date: March 16, 2013
Author: delroth
Changes:
  • COEF: Linear interpolation for resampling (instead of real 4-tap FIR)
  • IROM: Added all mixing functions, some unused functions still missing
  • Works with AX, AXWii, and Zelda UCode games
  • Card/IPL/GBA UCodes likely still broken, require real DSP ROM
Date: July 31, 2011
Author: LM
Changes:
  • COEF: Fake (all zeroes)
  • IROM: Reversed and rewrote UCode loading/reset, everything else missing
  • Works with Zelda UCode games and some AX games
  • Compatible games: SMG 1/2, Pikmin 1/2, Zelda TP, Mario Kart DD, Luigi’s Mansion, Super Mario Sunshine, etc.
  • Only works if game doesn’t use COEF and IROM mixing functions

ROM Components

IROM (Instruction ROM):
  • Contains DSP microcode functions
  • Handles UCode loading and initialization
  • Provides mixing and audio processing routines
  • DMA transfer configuration
DROM/COEF (Coefficient ROM):
  • Contains coefficients for FIR filters
  • Used for audio resampling
  • Critical for audio quality

UCode Compatibility

UCode TypeSupport StatusNotes
ZeldaFullSupported since v0.1
AXFullSupported since v0.2
AXWiiFullSupported since v0.2
GBAFullSupported since v0.3
CardRequires real ROMNot fully supported
IPLRequires real ROMNot fully supported

CRC Values

The legal ROM replacement generates specific CRC values:
VersionIROM CRCDROM CRC
0.40xe789b5a50xa4a575f5
0.3.10x128ea7a20xa4a575f5
0.30x3aa4a7930xa4a575f5
0.2.10xd9907f710xdb6880c1
0.20xd9907f710xb019c2fb
0.10x9c8f593c0x10000001
Dolphin may report wrong CRCs when using the legal ROM replacement instead of the official ROM, but this does not affect functionality for supported games.

Filter Coefficients

The DROM contains coefficients for 4-tap polyphase FIR (Finite Impulse Response) filters used in audio resampling.

Coefficient Generation

Starting with version 0.2.1, coefficients are generated using a Python script (generate_coefs.py) that:
  1. Calculates optimal filter coefficients
  2. Matches 23 specific values used by GBA UCode (v0.3+)
  3. Provides quality comparable to official DROM

Audio Quality Impact

VersionResampling MethodQuality
0.1None (zeroes)Poor - only for games not using resampling
0.2Linear interpolationBasic
0.2.1+4-tap polyphase FIRHigh - comparable to official

DMA Transfers

The DSP uses DMA (Direct Memory Access) for efficient data transfer between main memory and DSP memory.

BootUCode DMA Configuration

The BootUCode function configures DMA transfers using: IX Registers (Index registers):
  • Traditional method for DMA configuration
  • Single transfer per call
AX Registers (Accumulator extended):
  • Added in v0.3 for GBA UCode support
  • Allows two sequential transfers in one call
  • GBA UCode requires this functionality
Version 0.4 removed use of SRS instructions with AX registers, as these instructions don’t actually exist in the real DSP hardware.

DSP User’s Manual

The repository includes a comprehensive LaTeX-based DSP User’s Manual with detailed instruction set documentation.

Building the Manual

  1. Install a LaTeX environment (e.g., MiKTeX)
  2. Install required packages listed in GameCube_DSP_Users_Manual.tex
  3. Run pdflatex twice:
    pdflatex GameCube_DSP_Users_Manual.tex
    pdflatex GameCube_DSP_Users_Manual.tex
    
  4. The second pass builds the table of contents and indexes
Search for \usepackage statements in the TEX file to find all dependencies. Common packages include:
  • Standard document formatting packages
  • Code listing packages
  • Diagram and table packages
  • Index generation packages

Implementation Notes

Dolphin DSP Emulation Modes

Dolphin offers multiple DSP emulation backends:
  1. DSP HLE (High-Level Emulation):
    • Fast, high-level reimplementation
    • Doesn’t require DSP ROM
    • May have compatibility issues with some games
  2. DSP LLE Interpreter:
    • Low-level emulation
    • Accurate but slower
    • Uses legal ROM replacement or real DSP ROM
  3. DSP LLE Recompiler:
    • Low-level emulation with JIT compilation
    • Balance of accuracy and performance
    • Uses legal ROM replacement or real DSP ROM

Performance Considerations

  • HLE is fastest but may have audio glitches
  • LLE Interpreter is most accurate but CPU-intensive
  • LLE Recompiler provides good accuracy with better performance
  • Legal ROM replacement has minimal performance impact vs real ROM
For most games, the legal DSP ROM replacement provides full compatibility with the LLE backends while avoiding copyright concerns.