runtimenintendo-dslibnds

Any way to execute DS code from cartridge?


From what I know, code to run on the DS has to be loaded into RAM, thus taking from the already-restrictive 4M. Is there any way to run DS code directly from the image?


Solution

  • Short answer: No.

    The memory map of the Nintendo DS doesn't include any location that maps to ROM in the DS cartridge.

    By comparison, on the Game Boy Advance the area 08000000-09FFFFFF was mapped to the external ROM in the Game Pak. This mapping is included in the DS too, presumably for backwards compatibility and to enable some GBA game and DS game interaction (e.g. Castlevania: Dawn of Sorrow easter eggs). But it only maps to the GBA slot and so only to GBA cartridges.

    You could use this feature to read from GBA cartridges in the GBA slot and run code from there in DS mode. Early unofficial rewritable cartridges did just that. This is not very future-proof - it won't work on the DSi which has no such GBA slot. Additionally, Slot-2 cartridges are harder to find nowadays with the regular DS-style cartridges being far more popular and available.

    The usual way to create large games that need to run more code than there is memory is to either use code overlays or write your game in a scripting-type language that can load and unload code dynamically.