Start implementing IRQ

This commit is contained in:
Jeffrey Pfau 2013-04-16 07:18:25 -07:00
parent 7de2c91efb
commit 9ac6f6d3bf
3 changed files with 28 additions and 3 deletions

View File

@ -1,5 +1,7 @@
#include "gba-video.h"
#include "gba.h"
#include <limits.h>
static void GBAVideoDummyRendererInit(struct GBAVideoRenderer* renderer);
@ -61,7 +63,7 @@ int32_t GBAVideoProcessEvents(struct GBAVideo* video, int32_t cycles) {
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 @@ int32_t GBAVideoProcessEvents(struct GBAVideo* video, int32_t cycles) {
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 @@ int32_t GBAVideoProcessEvents(struct GBAVideo* video, int32_t cycles) {
//video->cpu.mmu.runHblankDmas();
}
if (video->hblankIRQ) {
//video->cpu.irq.raiseIRQ(video->cpu.irq.IRQ_HBLANK);
GBARaiseIRQ(video->p, IRQ_HBLANK);
}
}

View File

@ -86,6 +86,10 @@ void GBALoadROM(struct GBA* gba, int fd) {
// 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);

View File

@ -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
@ -41,6 +58,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);
void GBALoadROM(struct GBA* gba, int fd);