GB: Fix DI
Jeffrey Pfau jeffrey@endrift.com
Wed, 27 Jan 2016 21:41:44 -0800
2 files changed,
7 insertions(+),
8 deletions(-)
M
src/gb/gb.c
→
src/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.h
→
src/gb/gb.h
@@ -58,7 +58,7 @@ struct VFile* sramVf;
const char* activeFile; - bool eiPending; + bool diPending; }; struct GBCartridge {