mirror of https://github.com/mgba-emu/mgba.git
SM83: Improve mid-M-cycle interrupts
This commit is contained in:
parent
f853de37b9
commit
039a64ee62
1
CHANGES
1
CHANGES
|
@ -64,6 +64,7 @@ Emulation fixes:
|
||||||
- GBA Video: Emulate sprite cycle limits in OpenGL renderer (fixes mgba.io/i/1635)
|
- GBA Video: Emulate sprite cycle limits in OpenGL renderer (fixes mgba.io/i/1635)
|
||||||
- GBA Video: Fix OBJWIN erratic rendering in OpenGL renderer
|
- GBA Video: Fix OBJWIN erratic rendering in OpenGL renderer
|
||||||
- SM83: Emulate HALT bug
|
- SM83: Emulate HALT bug
|
||||||
|
- SM83: Improve mid-M-cycle interrupts
|
||||||
Other fixes:
|
Other fixes:
|
||||||
- 3DS: Fix thread cleanup
|
- 3DS: Fix thread cleanup
|
||||||
- All: Improve export headers (fixes mgba.io/i/1738)
|
- All: Improve export headers (fixes mgba.io/i/1738)
|
||||||
|
|
|
@ -153,11 +153,19 @@ static inline bool _SM83TickInternal(struct SM83Core* cpu) {
|
||||||
_SM83Step(cpu);
|
_SM83Step(cpu);
|
||||||
int t = cpu->tMultiplier;
|
int t = cpu->tMultiplier;
|
||||||
if (cpu->cycles + t * 2 >= cpu->nextEvent) {
|
if (cpu->cycles + t * 2 >= cpu->nextEvent) {
|
||||||
int32_t diff = cpu->nextEvent - cpu->cycles;
|
if (cpu->cycles >= cpu->nextEvent) {
|
||||||
cpu->cycles = cpu->nextEvent;
|
cpu->irqh.processEvents(cpu);
|
||||||
cpu->executionState += diff >> (t - 1); // NB: This assumes tMultiplier is either 1 or 2
|
}
|
||||||
cpu->irqh.processEvents(cpu);
|
cpu->cycles += t;
|
||||||
cpu->cycles += (SM83_CORE_EXECUTE - cpu->executionState) * t;
|
++cpu->executionState;
|
||||||
|
if (cpu->cycles >= cpu->nextEvent) {
|
||||||
|
cpu->irqh.processEvents(cpu);
|
||||||
|
}
|
||||||
|
cpu->cycles += t;
|
||||||
|
++cpu->executionState;
|
||||||
|
if (cpu->cycles >= cpu->nextEvent) {
|
||||||
|
cpu->irqh.processEvents(cpu);
|
||||||
|
}
|
||||||
running = false;
|
running = false;
|
||||||
} else {
|
} else {
|
||||||
cpu->cycles += t * 2;
|
cpu->cycles += t * 2;
|
||||||
|
|
Loading…
Reference in New Issue