mirror of https://github.com/mgba-emu/mgba.git
GBA: Fix timing of reading from timer registers
This commit is contained in:
parent
9cc4c9e43d
commit
a85ae6563c
1
CHANGES
1
CHANGES
|
@ -48,6 +48,7 @@ Bugfixes:
|
||||||
- GBA Video: Fix windows not affecting sprites
|
- GBA Video: Fix windows not affecting sprites
|
||||||
- VFS: Fix line-reading to return proper values
|
- VFS: Fix line-reading to return proper values
|
||||||
- GBA Memory: Fix load/store multiple video memory waitstates
|
- GBA Memory: Fix load/store multiple video memory waitstates
|
||||||
|
- GBA: Fix timing of reading from timer registers
|
||||||
Misc:
|
Misc:
|
||||||
- Qt: Handle saving input settings better
|
- Qt: Handle saving input settings better
|
||||||
- Debugger: Free watchpoints in addition to breakpoints
|
- Debugger: Free watchpoints in addition to breakpoints
|
||||||
|
|
|
@ -451,7 +451,8 @@ void GBAApplyPatch(struct GBA* gba, struct Patch* patch) {
|
||||||
void GBATimerUpdateRegister(struct GBA* gba, int timer) {
|
void GBATimerUpdateRegister(struct GBA* gba, int timer) {
|
||||||
struct GBATimer* currentTimer = &gba->timers[timer];
|
struct GBATimer* currentTimer = &gba->timers[timer];
|
||||||
if (currentTimer->enable && !currentTimer->countUp) {
|
if (currentTimer->enable && !currentTimer->countUp) {
|
||||||
gba->memory.io[(REG_TM0CNT_LO + (timer << 2)) >> 1] = currentTimer->oldReload + ((gba->cpu->cycles - currentTimer->lastEvent) >> currentTimer->prescaleBits);
|
// Reading this takes two cycles (1N+1I), so let's remove them preemptively
|
||||||
|
gba->memory.io[(REG_TM0CNT_LO + (timer << 2)) >> 1] = currentTimer->oldReload + ((gba->cpu->cycles - currentTimer->lastEvent - 2) >> currentTimer->prescaleBits);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue