Nintendo 64 software can reserve SRAM for saving data.
Unlike the EEPROM and Controller Pak, SRAM can be handled by EPI in the same way as ordinary MASKROM, although the addressing is different.
As of May, 1997, the available SRAM has a capacity of 256Kbits. The start address is a physical address from 0x8000000. Each parameter is defined below.
/* definition for SRAM */ #define SRAM_START_ADDR 0x08000000 #define SRAM_SIZE 0x8000 #define SRAM_latency 0x5 #define SRAM_pulse 0x0c #define SRAM_pageSize 0xd #define SRAM_relDuration 0x2
The following are examples of the handler obtaining a function for SRAM. osSramInit uses these definitions for the examples.
#include "osint.h" #include "piint.h" #include "rcp.h" OSPiHandle SramHandle; /* * Name: osSramInit * * Description: * Initialize SRAM. * */ OSPiHandle * osSramInit(void) { u32 saveMask; if (SramHandle.baseAddress == PHYS_TO_K1(SRAM_START_ADDR)) return(&SramHandle); /* Fill basic information */ SramHandle.type = 3; SramHandle.baseAddress = PHYS_TO_K1(SRAM_START_ADDR); /* Get Domain parameters */ SramHandle.latency = (u8)SRAM_latency; SramHandle.pulse = (u8)SRAM_pulse; SramHandle.pageSize = (u8)SRAM_pageSize; SramHandle.relDuration = (u8)SRAM_relDuration; SramHandle.domain = PI_DOMAIN2; /* TODO SramHandle.speed = */ bzero(&(SramHandle.transferInfo), sizeof(SramHandle.transferInfo)); /* * Put the SramHandle onto PiTable */ saveMask = __osDisableInt(); SramHandle.next = __osPiTable; __osPiTable = &SramHandle; __osRestoreInt(saveMask); return(&SramHandle); } /* osSramInit */
If SRAM is connected to the AD16bus, it can be used when developing software. For example, if Partner-N64 is used, SRAM can be used by inserting the SRAM board into the slot located in the upper part of Emulator ROM. If used on an N64 Control Deck, either flash ROM software, which has built-in SRAM, or a two-way socket DCC-Board with N64JOINT connected must be used.