Add store callbacks

This commit is contained in:
Jeffrey Pfau 2013-04-06 04:20:44 -07:00
parent 96da9c7ef1
commit 9efc945f1b
2 changed files with 90 additions and 0 deletions

View File

@ -4,6 +4,7 @@
void GBAInit(struct GBA* gba) { void GBAInit(struct GBA* gba) {
ARMInit(&gba->cpu); ARMInit(&gba->cpu);
gba->memory.p = gba;
GBAMemoryInit(&gba->memory); GBAMemoryInit(&gba->memory);
} }
@ -17,6 +18,9 @@ void GBAMemoryInit(struct GBAMemory* memory) {
memory->d.loadU16 = GBALoadU16; memory->d.loadU16 = GBALoadU16;
memory->d.load8 = GBALoad8; memory->d.load8 = GBALoad8;
memory->d.loadU8 = GBALoadU8; memory->d.loadU8 = GBALoadU8;
memory->d.store32 = GBAStore32;
memory->d.store16 = GBAStore16;
memory->d.store8 = GBAStore8;
memory->bios = 0; memory->bios = 0;
memory->wram = mmap(0, SIZE_WORKING_RAM, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0); memory->wram = mmap(0, SIZE_WORKING_RAM, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0);
@ -198,3 +202,84 @@ uint8_t GBALoadU8(struct ARMMemory* memory, uint32_t address) {
return 0; return 0;
} }
void GBAStore32(struct ARMMemory* memory, uint32_t address, int32_t value) {
struct GBAMemory* gbaMemory = (struct GBAMemory*) memory;
switch (address & OFFSET_MASK) {
case REGION_WORKING_RAM:
break;
case REGION_WORKING_IRAM:
break;
case REGION_IO:
break;
case REGION_PALETTE_RAM:
break;
case REGION_VRAM:
break;
case REGION_OAM:
break;
case REGION_CART0:
break;
case REGION_CART2_EX:
break;
case REGION_CART_SRAM:
break;
default:
break;
}
}
void GBAStore16(struct ARMMemory* memory, uint32_t address, int16_t value) {
struct GBAMemory* gbaMemory = (struct GBAMemory*) memory;
switch (address & OFFSET_MASK) {
case REGION_WORKING_RAM:
break;
case REGION_WORKING_IRAM:
break;
case REGION_IO:
break;
case REGION_PALETTE_RAM:
break;
case REGION_VRAM:
break;
case REGION_OAM:
break;
case REGION_CART0:
break;
case REGION_CART2_EX:
break;
case REGION_CART_SRAM:
break;
default:
break;
}
}
void GBAStore8(struct ARMMemory* memory, uint32_t address, int8_t value) {
struct GBAMemory* gbaMemory = (struct GBAMemory*) memory;
switch (address & OFFSET_MASK) {
case REGION_WORKING_RAM:
break;
case REGION_WORKING_IRAM:
break;
case REGION_IO:
break;
case REGION_PALETTE_RAM:
break;
case REGION_VRAM:
break;
case REGION_OAM:
break;
case REGION_CART0:
break;
case REGION_CART2_EX:
break;
case REGION_CART_SRAM:
break;
default:
break;
}
}

View File

@ -43,6 +43,7 @@ enum {
struct GBAMemory { struct GBAMemory {
struct ARMMemory d; struct ARMMemory d;
struct GBA* p;
int32_t* bios; int32_t* bios;
int32_t* wram; int32_t* wram;
@ -72,4 +73,8 @@ uint16_t GBALoadU16(struct ARMMemory* memory, uint32_t address);
int8_t GBALoad8(struct ARMMemory* memory, uint32_t address); int8_t GBALoad8(struct ARMMemory* memory, uint32_t address);
uint8_t GBALoadU8(struct ARMMemory* memory, uint32_t address); uint8_t GBALoadU8(struct ARMMemory* memory, uint32_t address);
void GBAStore32(struct ARMMemory* memory, uint32_t address, int32_t value);
void GBAStore16(struct ARMMemory* memory, uint32_t address, int16_t value);
void GBAStore8(struct ARMMemory* memory, uint32_t address, int8_t value);
#endif #endif