N64 Game Paks can incorporate SRAM with a battery-backup to save data. Unlike EEPROM and the Controller Pak, SRAM can be managed using the PI functions just like normal Mask ROM, even though the addressing is different.
You can utilize this during software development by connecting a SRAM board to the development equipment.
To access SRAM from NuSystem you first need to initialize with the following function:
Function name: | nuPiInitSram |
Syntax: | void nuPiInitSram (void) |
Arguments: | None |
Return Value: | None |
After initialization is completed, you can use the nuPiReadSram macro for reading from SRAM and the nuPiWriteSram macro for writing to SRAM.
Function name: | nuPiReadSram | |
Syntax: | void nuPiReadSram(u32 addr, void* buf_ptr, u32 size) | |
Arguments: | addr | SRAM address |
buf_ptr | Buffer pointer | |
size | Transfer size |
Function name: | nuPiWriteSram | |
Syntax | void nuPiWriteSram(u32 addr, void* buf_ptr, u32 size) | |
Arguments: | addr | SRAM Address |
buf_ptr | Buffer pointer | |
size | Transfer size |
For both reading and writing, the SRAM address "addr" must have 2byte alignment and the buffer pointer "buf_ptr" must have 8byte alignment.
The macros nuPiReadSram and nuPiWriteSram can be replaced with the function call to nuPiReadWriteSram.