all repos — mgba @ 213ba2996479391de53af8cca42f48820ce75d69

mGBA Game Boy Advance Emulator

GB: Fix DI
Jeffrey Pfau jeffrey@endrift.com
Wed, 27 Jan 2016 21:41:44 -0800
commit

213ba2996479391de53af8cca42f48820ce75d69

parent

dbdd61cdcdef83d47402c187acd1ff6e16ff9ccb

2 files changed, 7 insertions(+), 8 deletions(-)

jump to
M src/gb/gb.csrc/gb/gb.c

@@ -54,7 +54,7 @@ gb->pristineRom = 0;

gb->pristineRomSize = 0; gb->yankedRomSize = 0; - gb->eiPending = false; + gb->diPending = false; } bool GBLoadROM(struct GB* gb, struct VFile* vf, struct VFile* sav, const char* fname) {

@@ -201,10 +201,9 @@ int32_t cycles = cpu->nextEvent;

int32_t nextEvent = INT_MAX; int32_t testEvent; - if (gb->eiPending) { - gb->memory.ime = true; - GBUpdateIRQs(gb); - gb->eiPending = false; + if (gb->diPending) { + gb->memory.ime = false; + gb->diPending = false; } testEvent = GBVideoProcessEvents(&gb->video, cycles);

@@ -233,14 +232,14 @@ }

void GBSetInterrupts(struct LR35902Core* cpu, bool enable) { struct GB* gb = (struct GB*) cpu->master; - if (!enable) { + if (enable) { gb->memory.ime = enable; GBUpdateIRQs(gb); } else { if (cpu->nextEvent > 4) { cpu->nextEvent = 4; } - gb->eiPending = true; + gb->diPending = true; } }
M src/gb/gb.hsrc/gb/gb.h

@@ -58,7 +58,7 @@ struct VFile* sramVf;

const char* activeFile; - bool eiPending; + bool diPending; }; struct GBCartridge {