Actually use GBATestIRQ

This commit is contained in:
Jeffrey Pfau 2013-10-09 01:56:59 -07:00
parent 6906df95e2
commit 09a0f95ed4
4 changed files with 8 additions and 5 deletions

View File

@ -93,6 +93,7 @@ struct ARMBoard {
void (*processEvents)(struct ARMBoard* board); void (*processEvents)(struct ARMBoard* board);
void (*swi16)(struct ARMBoard* board, int immediate); void (*swi16)(struct ARMBoard* board, int immediate);
void (*swi32)(struct ARMBoard* board, int immediate); void (*swi32)(struct ARMBoard* board, int immediate);
void (*readCPSR)(struct ARMBoard* board);
void (*hitStub)(struct ARMBoard* board, uint32_t opcode); void (*hitStub)(struct ARMBoard* board, uint32_t opcode);
}; };

View File

@ -97,6 +97,7 @@ static inline void _ARMSetMode(struct ARMCore* cpu, enum ExecutionMode execution
static inline void _ARMReadCPSR(struct ARMCore* cpu) { static inline void _ARMReadCPSR(struct ARMCore* cpu) {
_ARMSetMode(cpu, cpu->cpsr.t); _ARMSetMode(cpu, cpu->cpsr.t);
ARMSetPrivilegeMode(cpu, cpu->cpsr.priv); ARMSetPrivilegeMode(cpu, cpu->cpsr.priv);
cpu->board->readCPSR(cpu->board);
} }
#endif #endif

View File

@ -69,6 +69,7 @@ void GBABoardInit(struct GBABoard* board) {
board->d.processEvents = GBAProcessEvents; board->d.processEvents = GBAProcessEvents;
board->d.swi16 = GBASwi16; board->d.swi16 = GBASwi16;
board->d.swi32 = GBASwi32; board->d.swi32 = GBASwi32;
board->d.readCPSR = GBATestIRQ;
board->d.hitStub = GBAHitStub; board->d.hitStub = GBAHitStub;
} }
@ -372,13 +373,13 @@ void GBARaiseIRQ(struct GBA* gba, enum GBAIRQ irq) {
} }
} }
int GBATestIRQ(struct GBA* gba) { void GBATestIRQ(struct ARMBoard* board) {
struct GBABoard* gbaBoard = (struct GBABoard*) board;
struct GBA* gba = gbaBoard->p;
if (gba->memory.io[REG_IME >> 1] && gba->memory.io[REG_IE >> 1] & gba->memory.io[REG_IF >> 1]) { if (gba->memory.io[REG_IME >> 1] && gba->memory.io[REG_IE >> 1] & gba->memory.io[REG_IF >> 1]) {
gba->springIRQ = 1; gba->springIRQ = 1;
gba->cpu.nextEvent = gba->cpu.cycles; gba->cpu.nextEvent = 0;
return 1;
} }
return 0;
} }
int GBAWaitForIRQ(struct GBA* gba) { int GBAWaitForIRQ(struct GBA* gba) {

View File

@ -109,7 +109,7 @@ void GBATimerWriteTMCNT_HI(struct GBA* gba, int timer, uint16_t value);
void GBAWriteIE(struct GBA* gba, uint16_t value); void GBAWriteIE(struct GBA* gba, uint16_t value);
void GBAWriteIME(struct GBA* gba, uint16_t value); void GBAWriteIME(struct GBA* gba, uint16_t value);
void GBARaiseIRQ(struct GBA* gba, enum GBAIRQ irq); void GBARaiseIRQ(struct GBA* gba, enum GBAIRQ irq);
int GBATestIRQ(struct GBA* gba); void GBATestIRQ(struct ARMBoard* board);
int GBAWaitForIRQ(struct GBA* gba); int GBAWaitForIRQ(struct GBA* gba);
int GBAHalt(struct GBA* gba); int GBAHalt(struct GBA* gba);