Turned on if the GBA is in halt-mode (waiting for interrupt).
bool haltModeOn
Generates a HBlank interrupt if the environment allows that.
inline void HBlank()
This is the main function of DMAChannels.
inline bool Idle()
Performs idle operations on timers.
inline void Idle( int cyclesCount )
Set the cpu to a starting state
void Initialize()
Initializes ncurses and the windows fields in the interface.
void Initialize()
Initializes a window and opengl with its vbs and shaders
int Initialize( int screenMultiplier = 1 )
Fills the ROM memory reading data from a file.
bool InsertCartridge( char * fileName )
Writes to the IF Register the interrupt code.
inline void Interrupt( int code )
Turned on if the previous operation accessed IOMemory.
bool ioMemAccessed
IORegisters memory.
int8_t ioram[0x808 ]
The internal working ram.
int8_t iwram[0x8000 ]
ID of the last memory zone that has been accessed.
int lastAccessZone
Loads the bios into its memory space (0x00000000-0x02000000) reading data from a file.
bool LoadBios( char * filename )
Entry Point of the application
int main( int argc, char ** argv )
Represents an openGL window that displays the GBA video output.
class MainWindow
MainWindow( PPU * p, Memory * m )
Obsolete.
int mBGOrder[4]
How many cycles did the transfer consume?
int mConsumedCycles
The Current Program Status Register
reg_data mCPSR
We need it to generate interrupts (if enabled)
CPU* mCpu
A pointer to the cpu for interrupts.
CPU* mCpu
Pointer to cpu.
CPU* mCpu
Obsolete.
int mCurrentPixel
Pointers to memory areas where the index is the most significant byte of an address.
int8_t* mem_ptrs[16]
A pointer to the memory of the GBA.
Memory* memory
Another core of the device.
Memory memory
Represents the entire address space of the GBA.
struct Memory
Builds memory.
Memory()
Memory masks for all the address space “zones”.
extern uint32_t MemoryMasks[16]
The general purpose registers.
reg_data mGPRegisters[29]
Keeps track of Horizontal Count (which x is currently theoretically drawn).
int mHCOUNT
Pointer to the GBA Memory Structure.
Memory* mMemory
The most important field.
Memory* mMemory
A pointer to the memory to read LCD registers, vram, oam and pram.
Memory* mMemory
Pointer to the memory object of the associated GBA.
Memory* mMemory
The pipeline instruction prefetch of the CPU.
uint32_t mPrefetch
The Saved Program Status Registers of all the modes that support it.
reg_data mSPSR[4]
Sprites Memory.
int8_t oam [0x400 ]
Pointer to oam memory.
int8_t* oamMemory
Represents a Sprite in OAM memory.
struct OAMSprite
Builds and handles all OAMSprites and OAMTransformGroups contained in OAM memory.
class OAMSprites
Builds our oamsprites object.
OAMSprites( Memory * mem )
OAM (Object Attribute Memory) contains both sprite attributes and transformation groups.
struct OAMTransformGroup
Performs overflow operation on timer (generates irq if enabled, restarts with reload value, increments successive if countup is enabled).
inline void OverflowTimer( int index )
Pointer to the PA register (you might know it as dx ...
uint16_t* PA
Packs 3 channels into a 16 bit RGBA_5_5_5_1 format integer.
inline uint16_t pack_rgb( int r, int g, int b )
Represent a palette entry (the name “Palette” is not proper here).
struct Palette
Builds the Palettes object.
Palettes( Memory * mem )
Palettes (It is actually plural, since it represent a set of Palette).
Palettes palettes
A reinterpretation of pram to make things understandable.
Palettes* palettes
Represents the full set of palettes.
class Palettes
Parses a condition string.
bool Parse( char * str )
Pointer to the PB register (you might know it as dmx ...
uint16_t* PB
Pointer to the PC register (you might know it as dy ...
uint16_t* PC
Pointer to the PD register (you might know it as dmy ...
uint16_t* PD
Another core of the device.
PPU ppu
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
Builds a PPU.
PPU( Memory * mem, CPU * cpu, Palettes * pal, OAMSprites * spr )
Pointers to the render functions.
extern void ( * PPU_renderers[6] )(PPU*,unsigned char*)
True when the ppu is accessing memory.
bool ppuAccessingMemory
The Palette Ram.
int8_t pram [0x400 ]
Reinterpret Cast of the pram of the GBA.
Palette* pram
The previous VCount register is stored here.
uint32_t prevVcount
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 )
Reads 8 bit at the given emulated address.
inline uint8_t Read8( uint32_t addr )
Represent a register.
union reg_data
Renders a background in text mode.
inline void render_bg_textmode( PPU * ppu, uint16_t bgcnt, uint16_t bghofs, uint16_t bgvofs, uint16_t * outBuffer )
Renders a background with 16/16 palettes/color mode.
inline void render_bg_textmode_tile4( PPU * ppu, uint16_t bgcnt, uint16_t bghofs, uint16_t bgvofs, uint16_t * outBuffer )
Renders a background with 256/1 colors/palette mode.
inline void render_bg_textmode_tile8( PPU * ppu, uint16_t bgcnt, uint16_t bghofs, uint16_t bgvofs, uint16_t * outBuffer )
Renders a background with rendering mode 0.
void render_mode0( PPU * ppu, unsigned char * outBuffer )
UNIMPLEMENTED.
void render_mode1( PPU * ppu, unsigned char * outBuffer )
UNIMPLEMENTED.
void render_mode2( PPU * ppu, unsigned char * outBuffer )
UNIMPLEMENTED.
void render_mode3( PPU * ppu, unsigned char * outBuffer )
Renders a background with rendering mode 4.
void render_mode4( PPU * ppu, unsigned char * outBuffer )
UNIMPLEMENTED.
void render_mode5( PPU * ppu, unsigned char * outBuffer )
Renders all the sprites of the ppu into its sprites buffer PPU.buffer_obj.
inline void render_objsprites( PPU * ppu, void * tilesMem )
Renders a sprite (into sprites buffer).
inline void render_sprite( PPU * ppu, OAMSprite * sprite, void * tilesMem )
Renders a sprite (into sprites buffer) that has rotation/scale disabled.
inline void render_sprite_fixed( PPU * ppu, OAMSprite * sprite, void * tilesMem )
Renders a sprite (into sprites buffer) that has rotation/scale enabled.
inline void render_sprite_rotscale( PPU * ppu, OAMSprite * sprite, void * tilesMem )
Resizes windows to fill the available area.
void Resize()