GB: Fix eiPending issue
Jeffrey Pfau jeffrey@endrift.com
Mon, 23 May 2016 20:13:51 -0700
1 files changed,
4 insertions(+),
4 deletions(-)
jump to
M
src/gb/gb.c
→
src/gb/gb.c
@@ -65,7 +65,7 @@ gb->yankedRomSize = 0;
gb->stream = NULL; - gb->eiPending = false; + gb->eiPending = INT_MAX; gb->doubleSpeed = 0; }@@ -301,12 +301,12 @@ int32_t cycles = cpu->nextEvent;
int32_t nextEvent = INT_MAX; int32_t testEvent; - if (gb->eiPending) { + if (gb->eiPending != INT_MAX) { gb->eiPending -= cycles; if (gb->eiPending <= 0) { gb->memory.ime = true; GBUpdateIRQs(gb); - gb->eiPending = 0; + gb->eiPending = INT_MAX; } }@@ -349,7 +349,7 @@ void GBSetInterrupts(struct LR35902Core* cpu, bool enable) {
struct GB* gb = (struct GB*) cpu->master; if (!enable) { gb->memory.ime = enable; - gb->eiPending = 0; + gb->eiPending = INT_MAX; GBUpdateIRQs(gb); } else { if (cpu->nextEvent > cpu->cycles + 4) {