Repository navigation
DSi System Software
What the DSi menu, its launcher and the system apps do and expect, found by tracing them in Maelle. This matters for emulators and loaders that boot titles directly instead of through the menu. Unless marked otherwise, everything here is Software: it's what the real system software needs, checked on a Wii U. See Hardware notes.
These were found by dumping CPU registers, I/O (0x4000000-0x4000700 and 0x4004000-0x4005000 for each CPU) and RAM from 0x2FF0000 at the moment the PC reaches the header's ARM9 and ARM7 entry points. The dump was done once with a launch from the real DSi menu, and once with direct boot.
-
Both headers are in RAM. The launcher copies the DSi header to 0x2FFE000, but also leaves the NDS header at
0x2FFFE00. DSi titles read the NDS one to mount their files. Without it, Pokémon Black 2 in DSi mode finds no file
table, never loads its overlays, and jumps into one that was never loaded
(
55ff6bd). -
Modcrypt areas are decrypted before the title starts. Retail DSi titles encrypt part of their DSi-only code with
AES-CTR. The key comes from the game code and the ARM9i hash in the header, through the AES key scrambler
(
aa157a1). -
The system settings flags at 0x2000400 (a copy of TWLCFG) are 0x0100000F after a menu launch: Wi-Fi enabled
(bit 3) and EULA agreed (bit 24). If they're 0, Black 2's Mystery Gift says wireless communication is off
(
2f18e55). - The EULA version at 0x2000410 must be 1. Without it, titles never use SDIO and fail with error 50599.
-
The Wi-Fi firmware info at 0x20005E0 (board type, CRC, three words) must be there, and the firmware must already be
on the chip. Titles count on the system having uploaded it. Without that, Black 2 stops after 7 BMI commands with error
50199 (
bc53b3b). Maelle's values for boards 2 and 3 are Unverified: recalled from melonDS, with the CRC computed by GBATEK's rule. The tested DSi has board 1. - The menu leaves no chip ID at 0x2FFF800. Direct boot writes one anyway.
-
The device list for DSiWare is at the RAM address in the DSi header's word at 0x1D4. A launch of the DSi Browser gives the entries
nand,nand2,shared1andphoto. Unlaunch's convention addssdmc,dataPub/dataPrvpointing atsdmc:/CODE.PUBandsdmc:/CODE.PRV, and the app's own pathsdmc:/CODE.APPat +0x3C0. DSiWare finds its own file and saves through this list (69213fe). -
DSiWare is marked by bit 2 at header offset 0x234, in the title ID. Unit code 3 is DSi-only
(
a3574c5). - New DSiWare saves are FAT12 volumes, as the DSi formats them.
Measured from the handover dump (eb123d9,
63376b9):
| Register | DSi menu leaves | Notes |
|---|---|---|
SNDEXCNT |
0x800F | Same for DS and DSi titles |
GPIO_DATA/GPIO_DIR
|
0x80D7 | GPIO33[3] an output |
GPIO_IEDGE/GPIO_IE
|
0x4000 | GPIO33[2] interrupting |
GPIO_WIFI |
0x0100 | DS Wi-Fi mode |
SCFG_CLK |
0x0080 for DS titles, 0x0084 for DSi titles | Bit 0 is clear for both, so the ARM9 is at 67 MHz when the title starts, and DSi titles switch to 133 MHz themselves |
POWCNT1 |
0x820F | |
EXMEMCNT |
0xE88C | |
| ARM7 SCFG access | Revoked | A direct boot keeps it, like melonDS, so the title can do its own setup |
| TSC | DS mode for DS titles | And for DSi titles with header 0x1BF bit 0 clear |
SCFG_ROM |
Bit 10 differs |
The menu also leaves its own leftovers at 0x2FFEE00-0x2FFFDFF, and uses the firmware language from the NAND.
For a DS title, the launcher limits main RAM to 4 MB through SCFG_EXT9, and does it before its last handshake with
the ARM7, while it still needs all 16 MB. An emulator has to hold the switch until the handshake. melonDS does this,
and so does Maelle, recognizing the launcher by its code range 0x23FEE00-0x23FF000
(fdb4691, 5a651ab).
If the switch happens straight away, the ARM7's copy of the system area to 0x027FF000 lands on the launcher's last code
at 0x023FEE00 while the ARM9 is still running it.
-
It writes MBK4/MBK5 slots 0-2 about 4,500 times in the ~40 frames after A is pressed, moving NWRAM-C slots between the
ARM9 and ARM7 (ARM9 PC 0x026C1540/0x026C15C4). Many of those writes change nothing. An emulator that rebuilds memory
maps or scans code caches on every slot write will be very slow here
(
e2cdf64). -
It reads cards with ARM7 DMA, a word at a time (
ad33082). - The ARM7 runs from NWRAM (0x03xxxxxx) a lot in DSi mode, and the ARM9 also runs about 75,000 instructions a frame from there in the first 100 frames of boot.
-
The Health and Safety screen spins reading 16-bit
IMEabout 40,000 times a frame for about 400 frames (ARM9 PC 0x026D37C6) (fef15b9). - DSi system software is nearly all THUMB: 98% of the menu's ARM9 instructions and 55% of the Browser's. The menu redraws its text with a THUMB glyph bit reader every frame.
- The DSi Browser never idles. At 67 MHz it runs exactly half the instructions a frame it does at 133 MHz, so it uses whatever CPU it gets. Its hot spot is a 64-bit shift-and-subtract divide in ARM code (0x0206ED24-0x0206F208), about 29% of what it runs.
- The fatal error names are a table in the menu's RAM at 0x027299CC. Bit N of the error code is entry N.
- Startup race: see ARM CPUs. It needs the ARM9's code cache cost and the ARM7 at full speed outside main RAM.
- Its own SD/NAND driver (ARM7, at 0x02FCxxxx) has an interrupt handler for IE2 bit 8 (0x02FC4448) that posts one OS message per SD/MMC interrupt to a 5-entry queue (0x02FE24A0). See DSi hardware for why the interrupt must be edge-triggered.
- The volume slider writes MCU register 0x40 and reads it back.
-
Recording uses
MIC_CNTdirectly, not the DSP. The preview plays on SPU channels as looping PCM16, with timers 0xFC00/0xFE00, and the app refills the buffer just behind the playing position. An emulator that mixes sound late in batches must fetch channel data ahead of time, like the hardware's FIFOs, or the preview skips (3033e89). - It raises the mic gain to 33 dB. See DSi hardware.
- Music playback uses Nintendo's AAC DSP program.
- Photos are signed with AES-CCM over associated data only. See DSi hardware.
- It loads no DSP program. Its whole tutorial was checked: photo, lens, album, kaleidoscope edit, save.
-
Exit: the ARM9 sends the PM reboot command, disables IRQs and polls a handshake at 0x02FFFFF0. Meanwhile the ARM7's
touch auto-sampling sends 4 PXI messages (tag 6) a frame from a VCOUNT IRQ, and spins when the 16-entry FIFO is full. The
ARM7's reboot path is a
SOUNDBIASramp,WaitByLoop(0x10000), and a codec power-down withWaitByLoop(0x213D29 / 4)(about 65 ms), then MCU 0x70 and 0x11. If BIOS code runs at half speed, the FIFO fills first and the screen stays white (4dabf21). -
Backup to the SD card writes about 1,800 sectors, over 900 of them in one frame, as multi-block writes that put the
first block in the FIFO before CMD25 (
624b523,39c5951).
- Leaving it reboots through MCU 0x70 = 1, then 0x11 = 1. After a cold start, Health and Safety shows again, since 0x70 isn't kept.
- The connection test for connections 1-3 uses both Wi-Fi chips in turn. See DSi hardware.
- Pokémon Black 2 (DSi mode) HMAC-SHA1s card data through the BIOS every frame on its Press Start screen. After a Mystery Gift it restarts and verifies all four binaries against the DSi header.
- Korg DS-10+ reads the touchscreen the DS way, through header flag 0x1BF bit 0.
- A Kappa's Trail (DSiWare) is touch-only, and needs its modcrypted ARM7i's last partial block decrypted.