This is an old revision of the document!
Table of Contents
R4 (NDS) programming
Original research provided mostly by lifehackerhansol.
Control flags
- KEY1 gap1 length: 0
- KEY1 gap2 length: 24
- KEY2 encryption: Enabled for data and commands
- Transfer clock rate: 6.7 MHz
- Data block size: 4 bytes (512 bytes for SD commands)
Commands
Get card information (B0 ?? ?? ?? ?? ?? ?? ??)
If bit 0-2 are equal to 0x4, the card is an R4.
Save read request (B2 ?? ?? ?? ?? ?? ?? ??)
Possibly works the same as SD read request, but in save data space?
Save read data (B3 ?? ?? ?? ?? ?? ?? ??)
Possibly works the same as SD read data, but in save data space?
? FAT entry send ? (B4 sd sc sb sa 00 00 00)
- (MSB) sd sc sb sa (LSB) - sector address, in bytes
ROM read request (B6 ?? ?? ?? ?? ?? ?? ??)
Possibly works the same as SD read request, but in ROM space?
ROM read data (B7 ad ac ab aa ?? ?? ??)
Possibly works the same as SD read data, but in ROM space?
SD read request (B9 sd sc sb sa 00 00 00)
- (MSB) sd sc sb sa (LSB) - sector address, in bytes
Returns zero when data is ready to access, non-zero if ongoing.
SD read data (BA 00 00 00 00 00 00 00)
Returns the 512 bytes read via the “SD read start” command.
SD write start (BB sd sc sb sa 00 00 00)
- (MSB) sd sc sb sa (LSB) - sector address, in bytes
Followed by 512 bytes of SD card data.
SD write status (BC sd sc sb sa 00 00 00)
- (MSB) sd sc sb sa (LSB) - sector address, in bytes
Returns zero if done, non-zero if ongoing.
Save write start (BD ?? ?? ?? ?? ?? ?? ??)
Possibly works the same as SD write start, but in save data space?
Save write status (BE ?? ?? ?? ?? ?? ?? ??)
Possibly works the same as SD write status, but in save data space?