A card holds the first 2 KiB of its secure area, the start of an ARM9 program at 0x4000 to 0x7FFF, encrypted with
KEY1: Blowfish over the table at 0x30 of the DS's ARM7 BIOS, keyed by the game code (GBATEK's "DS Encryption by
Gamecode/Idcode (KEY1)"). The firmware decrypts them as it boots the card, checks that they start with the ID
encryObj and writes 0xE7FFDEFF twice over it. Most dumps hold them decrypted already, the ID destroyed, or kept and
then destroyed by the loader as the firmware does. An image that holds them as the card does is decrypted as it is
read, on every run, with the player's ARM7 BIOS (src/nds/cartridge/key1.c):
bios7.bin in the data folder: the run's (--data); else, for an image named, the program's (a
portable copy's, else the user's); else, for --game and a game's copy, the one the game's folder is in. The
launcher's Install Keys puts it there from its NDS row (the menu).encryObj with the image's game code is refused too, the error giving the 8 bytes it read
instead: the image is damaged there.An area that starts with code (a homebrew program at 0x4000) or with zeros (the SDK's way to leave it out) needs no BIOS. Neither the image nor the BIOS is copied: the decrypted 2 KiB are in the program the loader keeps in memory, the one the module is compiled from.
Made from docs/platforms/nds/README.md at 69237645142c. GPL-3.0-or-later.