SGDK
A free and open development kit for the Sega Mega Drive
Loading...
Searching...
No Matches
mapper.h
Go to the documentation of this file.
1
33
34#ifndef _MAPPER_H_
35#define _MAPPER_H_
36
37
38#include "config.h"
39#include "types.h"
40
41
42#define MAPPER_BASE 0xA130F1
43
44#define BANK_SIZE 0x80000
45#define BANK_IN_MASK (BANK_SIZE - 1)
46#define BANK_OUT_MASK (0xFFFFFFFF ^ BANK_IN_MASK)
47
56#if (ENABLE_BANK_SWITCH != 0)
57 #define FAR(data) SYS_getFarData((void*) (data))
58 #define FAR_SAFE(data, size) SYS_getFarDataSafe((void*) (data), size)
59#else
60 #define FAR(data) data
61 #define FAR_SAFE(data, size) data
62#endif
63
64
69void SYS_resetBanks();
70
78u16 SYS_getBank(u16 regionIndex);
86void SYS_setBank(u16 regionIndex, u16 bankIndex);
87
102void* SYS_getFarData(void* data);
116void* SYS_getFarDataEx(void* data, bool high);
128bool SYS_isCrossingBank(void* data, u32 size);
146void* SYS_getFarDataSafe(void* data, u32 size);
162void* SYS_getFarDataSafeEx(void* data, u32 size, bool high);
163
184void SYS_setNextFarAccessRegion(bool high);
185
186#endif // _MAPPER_H_
Basic SGDK library configuration file.
bool SYS_getNextFarAccessRegion()
Retrieve the value of the next used region for FAR access with bank switch if data is not already acc...
Definition mapper.c:272
void * SYS_getFarDataSafe(void *data, u32 size)
Make the given binary data ressource accessible and return a pointer to it (safe version with possibl...
Definition mapper.c:220
void SYS_setBank(u16 regionIndex, u16 bankIndex)
Set the current bank of specified region index.
Definition mapper.c:30
bool SYS_isCrossingBank(void *data, u32 size)
Returns TRUE if given binary data is crossing 2 512 KB banks.
Definition mapper.c:212
void SYS_setNextFarAccessRegion(bool high)
Set the value of the next used region for FAR access with bank switch if data is not already accessib...
Definition mapper.c:277
void * SYS_getFarData(void *data)
Make the given binary data ressource accessible and return a pointer to it.
Definition mapper.c:168
u16 SYS_getBank(u16 regionIndex)
Returns the current bank of specified region index.
Definition mapper.c:25
void * SYS_getFarDataSafeEx(void *data, u32 size, bool high)
Make the given binary data ressource accessible and return a pointer to it (safe version with possibl...
Definition mapper.c:246
void SYS_resetBanks()
Reset all banks to their initial / default value (automatically called at reset)
Definition mapper.c:17
void * SYS_getFarDataEx(void *data, bool high)
Make the given binary data ressource accessible and return a pointer to it.
Definition mapper.c:187
Types definition.
unsigned long u32
Definition types.h:105
unsigned short u16
Definition types.h:100