struct ASICRegisters
This struct holds 0x804 bytes of data. They are the special registers accessed in the 0x4000000 address class. This is only useful to give a name to those bytes. Its sizeof might be greater, but it doesn’t really matters. This might create problems with endianess. It is supposed to work only with little endian processors
Memory DMAChannels OAMSprites Timers CPU Palettes PPU
| ASICRegisters | This struct holds 0x804 bytes of data. |
| Variables | |
| MemoryMasks | Memory masks for all the address space “zones”. |
| Memory | Represents the entire address space of the GBA. |
| Variables | |
| bios | The bios memory. |
| ewram | The external working ram. |
| iwram | The internal working ram. |
| ioram | IORegisters memory. |
| pram | The Palette Ram. |
| vram | VideoRAM. |
| oam | Sprites Memory. |
| gba_rom | Cartridge emulated ROM. |
| gba_rom_size | The size of the ROM. |
| cart_ram | Cartridge RAM. |
| mem_ptrs | Pointers to memory areas where the index is the most significant byte of an address. |
| timer0Reload | Timer reload value. |
| timer1Reload | Timer reload value. |
| timer2Reload | Timer reload value. |
| timer3Reload | Timer reload value. |
| dummyValue | Dummy value to readdress null writes. |
| lastAccessZone | ID of the last memory zone that has been accessed. |
| cartridgeStoNAccess | Cartridge ROM has sequential and non-sequential accesses. |
| ppuAccessingMemory | True when the ppu is accessing memory. |
| ioMemAccessed | Turned on if the previous operation accessed IOMemory. |
| haltModeOn | Turned on if the GBA is in halt-mode (waiting for interrupt). |
| prevVcount | The previous VCount register is stored here. |
| usedWaitCnt | Which wait-control has been used? |
| drawFlag | Used by the rendering engine thread to signal it is rendering, so the cpu shall not get into VBLANK. |
| shallBreak | Switch used to generate breakpoints from the video-output window. |
| Functions | |
| Memory | Builds memory. |
| GetAddress | Returns the in-system address associated to the emulated address. |
| GetIORam | Gets IORam converted to the <ASICRegister> structure. |
| CheckIOAccess | Does all the operations needed after an IO access. |
| Read8 | Reads 8 bit at the given emulated address. |
| Read16 | Reads 16 bit at the given emulated address. |
| Read32 | Reads 32 bit at the given emulated address. |
| Write8 | Writes 8 bit at the given emulated address. |
| Write16 | Writes 16 bit at the given emulated address. |
| Write32 | Writes 32 bit at the given emulated address. |
| getWSCount | |
| ComputeWaitStates | Computes the wait states of the last memory access. |
| SetAccessAddr | Sets last access zone according to the address. |
| ComputeWaitStatesAB | Computes the WaitStates given an address. |
| GetSize | Computes the size of the emulated memory. |
struct Memory
Represents the entire address space of the GBA.
CPU PPU ASICRegisters OAMSprites Palettes DMAChannels GBA Timers Tile4 Tile8
| Variables | |
| bios | The bios memory. |
| ewram | The external working ram. |
| iwram | The internal working ram. |
| ioram | IORegisters memory. |
| pram | The Palette Ram. |
| vram | VideoRAM. |
| oam | Sprites Memory. |
| gba_rom | Cartridge emulated ROM. |
| gba_rom_size | The size of the ROM. |
| cart_ram | Cartridge RAM. |
| mem_ptrs | Pointers to memory areas where the index is the most significant byte of an address. |
| timer0Reload | Timer reload value. |
| timer1Reload | Timer reload value. |
| timer2Reload | Timer reload value. |
| timer3Reload | Timer reload value. |
| dummyValue | Dummy value to readdress null writes. |
| lastAccessZone | ID of the last memory zone that has been accessed. |
| cartridgeStoNAccess | Cartridge ROM has sequential and non-sequential accesses. |
| ppuAccessingMemory | True when the ppu is accessing memory. |
| ioMemAccessed | Turned on if the previous operation accessed IOMemory. |
| haltModeOn | Turned on if the GBA is in halt-mode (waiting for interrupt). |
| prevVcount | The previous VCount register is stored here. |
| usedWaitCnt | Which wait-control has been used? |
| drawFlag | Used by the rendering engine thread to signal it is rendering, so the cpu shall not get into VBLANK. |
| shallBreak | Switch used to generate breakpoints from the video-output window. |
| Functions | |
| Memory | Builds memory. |
| GetAddress | Returns the in-system address associated to the emulated address. |
| GetIORam | Gets IORam converted to the <ASICRegister> structure. |
| CheckIOAccess | Does all the operations needed after an IO access. |
| Read8 | Reads 8 bit at the given emulated address. |
| Read16 | Reads 16 bit at the given emulated address. |
| Read32 | Reads 32 bit at the given emulated address. |
| Write8 | Writes 8 bit at the given emulated address. |
| Write16 | Writes 16 bit at the given emulated address. |
| Write32 | Writes 32 bit at the given emulated address. |
| getWSCount | |
| ComputeWaitStates | Computes the wait states of the last memory access. |
| SetAccessAddr | Sets last access zone according to the address. |
| ComputeWaitStatesAB | Computes the WaitStates given an address. |
| GetSize | Computes the size of the emulated memory. |
inline int ComputeWaitStates( int cyclesS, int cyclesN, int accessWidth = 2 )
Computes the wait states of the last memory access.
| cyclesS | Number of sequential cycles |
| cyclesN | Number of non-sequential cycles |
| accessWidth | The width of the access (0=8bit, 1=16bit, 2=32bit) |
The number of wait cycles.
inline int ComputeWaitStatesAB( uint32_t addr, int cyclesS, int cyclesN, int accessWidth = 2 )
Computes the WaitStates given an address.
| addr | The address. |
| cyclesS | Number of sequential cycles |
| cyclesN | Number of non-sequential cycles |
| accessWidth | The width of the access (0=8bit, 1=16bit, 2=32bit) |
The number of wait cycles.
This struct holds 0x804 bytes of data.
struct ASICRegisters
Memory masks for all the address space “zones”.
extern uint32_t MemoryMasks[16]
Represents the entire address space of the GBA.
struct Memory
The bios memory.
int8_t bios [0x4000 ]
The external working ram.
int8_t ewram[0x40000]
The internal working ram.
int8_t iwram[0x8000 ]
IORegisters memory.
int8_t ioram[0x808 ]
The Palette Ram.
int8_t pram [0x400 ]
VideoRAM.
int8_t vram [0x20000]
Sprites Memory.
int8_t oam [0x400 ]
Cartridge emulated ROM.
int8_t* gba_rom
The size of the ROM.
uint32_t gba_rom_size
Cartridge RAM.
int8_t cart_ram[0x10000]
Pointers to memory areas where the index is the most significant byte of an address.
int8_t* mem_ptrs[16]
Timer reload value.
uint16_t timer0Reload
Timer reload value.
uint16_t timer1Reload
Timer reload value.
uint16_t timer2Reload
Timer reload value.
uint16_t timer3Reload
Dummy value to readdress null writes.
uint16_t dummyValue
ID of the last memory zone that has been accessed.
int lastAccessZone
Cartridge ROM has sequential and non-sequential accesses.
bool cartridgeStoNAccess
True when the ppu is accessing memory.
bool ppuAccessingMemory
Turned on if the previous operation accessed IOMemory.
bool ioMemAccessed
Turned on if the GBA is in halt-mode (waiting for interrupt).
bool haltModeOn
The previous VCount register is stored here.
uint32_t prevVcount
Which wait-control has been used?
uint32_t usedWaitCnt
Used by the rendering engine thread to signal it is rendering, so the cpu shall not get into VBLANK.
bool drawFlag
Switch used to generate breakpoints from the video-output window.
bool shallBreak
Builds memory.
Memory()
Returns the in-system address associated to the emulated address.
inline void* GetAddress( uint32_t addr )
Gets IORam converted to the ASICRegister structure.
inline ASICRegisters* GetIORam()
Does all the operations needed after an IO access.
inline void CheckIOAccess()
Reads 8 bit at the given emulated address.
inline uint8_t Read8( uint32_t addr )
Reads 16 bit at the given emulated address.
inline uint16_t Read16( uint32_t addr )
Reads 32 bit at the given emulated address.
inline uint32_t Read32( uint32_t addr )
Writes 8 bit at the given emulated address.
inline void Write8( uint32_t addr, uint8_t v )
Writes 16 bit at the given emulated address.
inline void Write16( uint32_t addr, uint16_t v )
Writes 32 bit at the given emulated address.
inline void Write32( uint32_t addr, uint32_t v )
inline int getWSCount( int id )
Computes the wait states of the last memory access.
inline int ComputeWaitStates( int cyclesS, int cyclesN, int accessWidth = 2 )
Sets last access zone according to the address.
inline void SetAccessAddr( uint32_t addr )
Computes the WaitStates given an address.
inline int ComputeWaitStatesAB( uint32_t addr, int cyclesS, int cyclesN, int accessWidth = 2 )
Computes the size of the emulated memory.
uint32_t GetSize()
DMA stands for Direct Memory Access.
class DMAChannels
Builds and handles all OAMSprites and OAMTransformGroups contained in OAM memory.
class OAMSprites
Easy interface to do operations with timers and their registers.
class Timers
This class represents an ARM7TDMI CPU running at 16.78MHZ with 32 bit registers and two execution modes (ARM32bit, THUMB16bit).
class CPU
Represents the full set of palettes.
class Palettes
This class represents the Picture Processing Unit of the GBA Functions in here are mostly inline utilities to make code inside renderers understandable.
class PPU
This is the class representing the entire device.
class GBA
32 bytes Tile, 4 bit depth.
struct Tile4
64 bytes Tile, 8 bit depth.
struct Tile8
Represent a palette entry (the name “Palette” is not proper here).
struct Palette
Represents a Sprite in OAM memory.
struct OAMSprite
OAM (Object Attribute Memory) contains both sprite attributes and transformation groups.
struct OAMTransformGroup