all repos — mgba @ 7025fbf84ad416e406d355203839f4893369c5a2

mGBA Game Boy Advance Emulator

GBA Timer: Minor cleanup
Vicki Pfau vi@endrift.com
Sat, 18 Jul 2020 02:22:56 -0700
commit

7025fbf84ad416e406d355203839f4893369c5a2

parent

d2ff393aa00e928d343e81b07e26cc54910896e8

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

jump to
M src/gba/timer.csrc/gba/timer.c

@@ -8,8 +8,6 @@

#include <mgba/internal/gba/gba.h> #include <mgba/internal/gba/io.h> -#define REG_TMCNT_LO(X) (REG_TM0CNT_LO + ((X) << 2)) - static void GBATimerIrq(struct GBA* gba, int timerId, uint32_t cyclesLate) { struct GBATimer* timer = &gba->timers[timerId]; if (GBATimerFlagsIsDoIrq(timer->flags)) {

@@ -131,7 +129,6 @@ int32_t tickIncrement = currentTime - timer->lastEvent;

timer->lastEvent = currentTime; tickIncrement >>= prescaleBits; tickIncrement += *io; - *io = tickIncrement; while (tickIncrement >= 0x10000) { tickIncrement -= 0x10000 - timer->reload; }

@@ -171,7 +168,7 @@ break;

} prescaleBits += timer->forcedPrescale; timer->flags = GBATimerFlagsSetPrescaleBits(timer->flags, prescaleBits); - timer->flags = GBATimerFlagsTestFillCountUp(timer->flags, timer > 0 && (control & 0x0004)); + timer->flags = GBATimerFlagsTestFillCountUp(timer->flags, timer > 0 && (control & 0x0004)); // TODO: Need timer ID timer->flags = GBATimerFlagsTestFillDoIrq(timer->flags, control & 0x0040); bool wasEnabled = GBATimerFlagsIsEnable(timer->flags); timer->flags = GBATimerFlagsTestFillEnable(timer->flags, control & 0x0080);