mirror of https://github.com/mgba-emu/mgba.git
GB: Fix IRQ disabling on the same T-cycle as an assert
This commit is contained in:
parent
1fb4d2be4d
commit
25cda2d7b2
1
CHANGES
1
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)
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
fail: true
|
11
src/gb/gb.c
11
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue