diff --git a/CHANGES b/CHANGES index 369634b11..3181ae785 100644 --- a/CHANGES +++ b/CHANGES @@ -45,6 +45,7 @@ Bugfixes: - GBA Video: Improve sprite cycle counting (fixes mgba.io/i/1126) - GB, GBA Savedata: Fix savestate loading overwriting saves on reset - GBA Video: Make layer disabling work consistently + - GB: Fix IRQ disabling on the same T-cycle as an assert Misc: - GBA Timer: Use global cycles for timers - GBA: Extend oddly-sized ROMs to full address space (fixes mgba.io/i/722) diff --git a/cinema/gb/mooneye-gb/acceptance/rapid_di_ei/manifest.yml b/cinema/gb/mooneye-gb/acceptance/rapid_di_ei/manifest.yml deleted file mode 100644 index a697ada66..000000000 --- a/cinema/gb/mooneye-gb/acceptance/rapid_di_ei/manifest.yml +++ /dev/null @@ -1 +0,0 @@ -fail: true diff --git a/src/gb/gb.c b/src/gb/gb.c index d5f809fb2..14404fddf 100644 --- a/src/gb/gb.c +++ b/src/gb/gb.c @@ -625,7 +625,11 @@ void GBUpdateIRQs(struct GB* gb) { } gb->cpu->halted = false; - if (!gb->memory.ime || gb->cpu->irqPending) { + if (!gb->memory.ime) { + gb->cpu->irqPending = false; + return; + } + if (gb->cpu->irqPending) { return; } LR35902RaiseIRQ(gb->cpu); @@ -661,12 +665,11 @@ void GBProcessEvents(struct LR35902Core* cpu) { void GBSetInterrupts(struct LR35902Core* cpu, bool enable) { struct GB* gb = (struct GB*) cpu->master; + mTimingDeschedule(&gb->timing, &gb->eiPending); if (!enable) { - gb->memory.ime = enable; - mTimingDeschedule(&gb->timing, &gb->eiPending); + gb->memory.ime = false; GBUpdateIRQs(gb); } else { - mTimingDeschedule(&gb->timing, &gb->eiPending); mTimingSchedule(&gb->timing, &gb->eiPending, 4); } } diff --git a/src/lr35902/lr35902.c b/src/lr35902/lr35902.c index 23878c310..4ae2a1e07 100644 --- a/src/lr35902/lr35902.c +++ b/src/lr35902/lr35902.c @@ -137,7 +137,7 @@ static void _LR35902Step(struct LR35902Core* cpu) { } void LR35902Tick(struct LR35902Core* cpu) { - if (cpu->cycles >= cpu->nextEvent) { + while (cpu->cycles >= cpu->nextEvent) { cpu->irqh.processEvents(cpu); } _LR35902Step(cpu);