Jump to content
Setting up an AI agent? ReverseEngineering.wiki skill (works from the command line, no configuration): https://reverseengineering.wiki/skill/rewiki/SKILL.md · setup for every client, including MCP: https://reverseengineering.wiki/llms.txt · REWiki:Connect

Format:Nintendo DS ROM image (NDS)

From ReverseEngineering.wiki
Format
Magic none at offset 0 (title at 0x00); Nintendo logo bytes at 0xC0
Extensions .nds, .dsi, .srl
Endianness little
On this wiki Facts · Code · Notes · Topics

Cartridge image of a Nintendo DS or DSi game (.nds): a 0x200-byte (DSi: 0x1000 with extensions) header describing the ARM9 and ARM7 binaries, overlay tables, the NitroFS file name and allocation tables and the icon banner.

Header

The header sits at offset 0 (see Fact:Nintendo DS ROM image (NDS)/struct/Header). Key fields: 12-byte game title, 4-byte game code, 2-byte maker code, unit code (0 NDS, 2 NDS+DSi, 3 DSi-only) at 0x12, then ARM9 and ARM7 blocks of (ROM offset, entry address, RAM address, size) at 0x20 and 0x30, the File Name Table (FNT) offset/size at 0x40, the File Allocation Table (FAT) offset/size at 0x48, ARM9/ARM7 overlay tables at 0x50 and 0x58, the banner offset at 0x68, total used ROM size at 0x80, header size at 0x84, the 156-byte compressed Nintendo logo at 0xC0, logo CRC16 at 0x15C and header CRC16 at 0x15E (as laid out in ndstool's header.h). DSi titles continue the header with MBK settings, region flags, the DSi ARM9i/ARM7i blocks, digest tables and a TWL title id.

Layout

Typical order: header, ARM9 binary (secure area first 0x4000 bytes, arm9_rom_offset is normally 0x4000), ARM7 binary, ARM9 and ARM7 overlay tables (Fact:Nintendo DS ROM image (NDS)/struct/Overlay table entry, 32 bytes each, overlay data lives in NitroFS files by file_id), FNT, FAT, banner, then file data. Every file (including overlays) is a (start, end) pair of u32 in the FAT; the FNT is the directory tree (root directory id 0xF000, as ndstool writes it).

The FNT is a table of 8-byte directory heads followed by the name lists (Fact:Nintendo DS ROM image (NDS)/struct/FNT directory entry). The ARM9 binary may be followed by 12-byte records starting 21 06 C0 DE, and a signature of 0x88 bytes can sit at the offset stored at 0x1000 (Fact:Nintendo DS ROM image (NDS)/behavior/ARM9 footer and RSA signature). Unverified: the purpose of those ARM9 trailing records; ndspy itself says it does not know it.

Decompilation projects also need the ARM9 module parameters (autoload list, static bss range, SDK version), which ndspy finds through the header words at 0x70 and 0x74 or by scanning for the bytes 21 06 C0 DE DE C0 06 21 (Fact:Nintendo DS ROM image (NDS)/struct/Module params, Fact:Nintendo DS ROM image (NDS)/magic/Module params marker, Fact:Nintendo DS ROM image (NDS)/behavior/Header 0x70 and 0x74 words). The first 0x4000 bytes of the ARM9 binary are the secure area, normally encrypted on retail cartridges; this wiki only records that it exists and where its CRC16 lives (header 0x6C, Fact:Nintendo DS ROM image (NDS)/behavior/Secure area CRC). Recognize an encrypted one by the test in Fact:Nintendo DS ROM image (NDS)/behavior/ROM type detection. The DSi part of the header (0x180 to 0x1000) is in Fact:Nintendo DS ROM image (NDS)/struct/DSi extended header.

See Fact:Nintendo DS ROM image (NDS)/struct/Banner: version u16 (1, 2, 3 or 0x103 for DSi), CRC16, 32x32 4bpp icon tiles (512 bytes) and a 16-colour BGR555 palette, then the title in UTF-16, 0x100 bytes per language (Japanese, English, French, German, Italian, Spanish; versions 2 and 3 add Chinese and Korean). Banner sizes: 0x840, 0x940, 0xA40, 0x23C0 (DSi).

Identification

There is no magic number at offset 0: check that the Nintendo logo CRC16 at 0x15C is 0xCF56 and that the unit code, ARM9 offset (>= 0x200) and header size make sense. ndstool does not hard-code 0xCF56: it recomputes both CRCs and prints OK or INVALID (Fact:Nintendo DS ROM image (NDS)/behavior/Header and logo CRC16). Unverified: that every retail logo yields 0xCF56 (a value from general knowledge of the format); to test, run the CRC of Fact:Nintendo DS ROM image (NDS)/behavior/Header and logo CRC16 over the 156 bytes at 0xC0 of a known ROM. Fact:Nintendo DS ROM image (NDS)/behavior/ROM type detection shows how ndstool tells homebrew, dumped and encrypted-secure-area ROMs apart.

Sub-formats

Tools

Tool:ndstool unpacks and repacks ROMs; Library:libnds is the homebrew library whose headers describe the same structures (tNDSHeader, sNDSBanner in nds/memory.h).

Code & repositories

  • https://github.com/devkitPro/ndstool @ 76e8b681bb225d945a48852821e03114e6c7ce1c · license: GPL-3.0
    ndstool: source/header.h (ROM header), banner.h, overlay.h, ndscreate.cpp (FNT/FAT writing).
    Tested on: source read, not run: source read · checked 2026-10-18; last activity 2024-11-11
  • https://github.com/devkitPro/libnds @ 84e6082ce27c87ed218fb369a9944644aa2243a6 · license: Zlib (declared by the contributor; GitHub's detector did not recognize a license file)
    libnds: include/nds/memory.h (tNDSHeader, DSi header, banner), dldi.h, bios.h, ipc.h.
    Tested on: source read, not run: source read · checked 2026-10-18; last activity 2026-02-19