all repos — mgba @ 74bb02065d232108192b41eb80e2889e000457bf

mGBA Game Boy Advance Emulator

GB, GBA: Properly handle late cycles this time
Jeffrey Pfau jeffrey@endrift.com
Fri, 07 Oct 2016 12:25:46 -0700
commit

74bb02065d232108192b41eb80e2889e000457bf

parent

4680a767c638530856255b133e7a88bf1ebb333e

2 files changed, 4 insertions(+), 4 deletions(-)

jump to
M src/gb/gb.csrc/gb/gb.c

@@ -528,11 +528,11 @@

void GBProcessEvents(struct LR35902Core* cpu) { struct GB* gb = (struct GB*) cpu->master; do { - int32_t cycles = cpu->nextEvent; + int32_t cycles = cpu->cycles; int32_t nextEvent; int32_t testEvent; - cpu->cycles -= cycles; + cpu->cycles = 0; cpu->nextEvent = INT_MAX; if (gb->eiPending != INT_MAX) {
M src/gba/gba.csrc/gba/gba.c

@@ -235,11 +235,11 @@ gba->springIRQ = 0;

} do { - int32_t cycles = cpu->nextEvent; + int32_t cycles = cpu->cycles; int32_t nextEvent; int32_t testEvent; - cpu->cycles -= cycles; + cpu->cycles = 0; cpu->nextEvent = INT_MAX; #ifndef NDEBUG