all repos — mgba @ 9ac6f6d3bfe2566c2e5960f5f9b6167d8e0a4ae9

mGBA Game Boy Advance Emulator

Start implementing IRQ
Jeffrey Pfau jeffrey@endrift.com
Tue, 16 Apr 2013 07:18:25 -0700
commit

9ac6f6d3bfe2566c2e5960f5f9b6167d8e0a4ae9

parent

7de2c91efb1e99409f9ab5bec0ae64580c2581e6

3 files changed, 28 insertions(+), 3 deletions(-)

jump to
M src/gba/gba-video.csrc/gba/gba-video.c

@@ -1,5 +1,7 @@

#include "gba-video.h" +#include "gba.h" + #include <limits.h> static void GBAVideoDummyRendererInit(struct GBAVideoRenderer* renderer);

@@ -61,7 +63,7 @@ video->renderer->finishFrame(video->renderer);

video->nextVblankIRQ = video->nextEvent + VIDEO_TOTAL_LENGTH; //video->cpu.mmu.runVblankDmas(); if (video->vblankIRQ) { - //video->cpu.irq.raiseIRQ(video->cpu.irq.IRQ_VBLANK); + GBARaiseIRQ(video->p, IRQ_VBLANK); } //video->vblankCallback(); break;

@@ -76,7 +78,7 @@ }

video->vcounter = video->vcount == video->vcountSetting; if (video->vcounter && video->vcounterIRQ) { - //video->cpu.irq.raiseIRQ(video->cpu.irq.IRQ_VCOUNTER); + GBARaiseIRQ(video->p, IRQ_VCOUNTER); video->nextVcounterIRQ += VIDEO_TOTAL_LENGTH; }

@@ -95,7 +97,7 @@ if (video->vcount < VIDEO_VERTICAL_PIXELS) {

//video->cpu.mmu.runHblankDmas(); } if (video->hblankIRQ) { - //video->cpu.irq.raiseIRQ(video->cpu.irq.IRQ_HBLANK); + GBARaiseIRQ(video->p, IRQ_HBLANK); } }
M src/gba/gba.csrc/gba/gba.c

@@ -86,6 +86,10 @@ gba->memory.rom = mmap(0, SIZE_CART0, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_FILE, fd, 0);

// TODO: error check } +void GBARaiseIRQ(struct GBA* gba, enum GBAIRQ irq) { + GBALog(GBA_LOG_STUB, "Attempting to raise IRQ"); +} + void GBALog(int level, const char* format, ...) { va_list args; va_start(args, format);
M src/gba/gba.hsrc/gba/gba.h

@@ -6,6 +6,23 @@

#include "gba-memory.h" #include "gba-video.h" +enum GBAIRQ { + IRQ_VBLANK = 0x0, + IRQ_HBLANK = 0x1, + IRQ_VCOUNTER = 0x2, + IRQ_TIMER0 = 0x3, + IRQ_TIMER1 = 0x4, + IRQ_TIMER2 = 0x5, + IRQ_TIMER3 = 0x6, + IRQ_SIO = 0x7, + IRQ_DMA0 = 0x8, + IRQ_DMA1 = 0x9, + IRQ_DMA2 = 0xA, + IRQ_DMA3 = 0xB, + IRQ_KEYPAD = 0xC, + IRQ_GAMEPAK = 0xD +}; + enum GBAError { GBA_NO_ERROR = 0, GBA_OUT_OF_MEMORY = -1

@@ -40,6 +57,8 @@ void GBAMemoryDeinit(struct GBAMemory* memory);

void GBABoardInit(struct GBABoard* board); void GBABoardReset(struct ARMBoard* board); + +void GBARaiseIRQ(struct GBA* gba, enum GBAIRQ irq); void GBAAttachDebugger(struct GBA* gba, struct ARMDebugger* debugger);