sgdk
|
SRAM (Static RAM used for save backup) support. More...
#include "mapper.h"
Go to the source code of this file.
Defines | |
#define | SRAM_CONTROL MAPPER_BASE |
#define | SRAM_BASE 0x200001 |
Functions | |
void | SRAM_enable () |
Enable SRAM in Read Write mode. | |
void | SRAM_enableRO () |
Enable SRAM in Read Only mode. | |
void | SRAM_disable () |
Disable SRAM. | |
u8 | SRAM_readByte (u32 offset) |
Read a byte from the SRAM. | |
u16 | SRAM_readWord (u32 offset) |
Read a word from the SRAM. | |
u32 | SRAM_readLong (u32 offset) |
Read a long from the SRAM. | |
void | SRAM_writeByte (u32 offset, u8 val) |
Write a byte to the SRAM. | |
void | SRAM_writeWord (u32 offset, u16 val) |
Write a word to the SRAM. | |
void | SRAM_writeLong (u32 offset, u32 val) |
Write a long to the SRAM. |
SRAM (Static RAM used for save backup) support.
This unit provides methods to read from or write to SRAM.
By default we suppose SRAM is 8bit and connected to odd address.
You can change to even address by changing SRAM_BASE from 0x200001 to 0x200000 and rebuild the library.
Informations about SRAM (taken from Segaretro.org):
The regions specified by 0xA130F9-0xA130FF (0x200000-0x3FFFFF) can be either ROM or RAM and can be write-protected.
Here is the layout of the register as far as I know:
7 6 5 4 3 2 1 0
+-----------------------+
|??|??|??|??|??|??|WP|MD|
+-----------------------+
MD: Mode -- 0 = ROM, 1 = RAM
WP: Write protect -- 0 = writable, 1 = not writable
Read a byte from the SRAM.
offset | Offset where we want to read. |
Read a long from the SRAM.
offset | Offset where we want to read. |
Read a word from the SRAM.
offset | Offset where we want to read. |
Write a byte to the SRAM.
offset | Offset where we want to write. |
val | Value wto write. |
Write a long to the SRAM.
offset | Offset where we want to write. |
val | Value wto write. |