all repos — mgba @ 601ece2e2aed5abc572a71a645af8adc84713970

mGBA Game Boy Advance Emulator

GB Audio: Fix frame sequencer timing in double speed mode (fixes #2071)
Vicki Pfau vi@endrift.com
Mon, 22 Mar 2021 18:42:44 -0700
commit

601ece2e2aed5abc572a71a645af8adc84713970

parent

9eee7a7c7ac4ee3fa595ca2672e91ce916c92803

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

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

@@ -31,7 +31,7 @@ if (!timer->p->memory.io[GB_REG_TIMA]) {

mTimingSchedule(&timer->p->timing, &timer->irq, 7 * tMultiplier - ((timer->p->cpu->executionState * tMultiplier - cyclesLate) & (3 * tMultiplier))); } } - unsigned timingFactor = 0x1FF; + unsigned timingFactor = (0x200 << timer->p->doubleSpeed) - 1; if ((timer->internalDiv & timingFactor) == timingFactor) { GBAudioUpdateFrame(&timer->p->audio); }

@@ -82,7 +82,7 @@ if (!timer->p->memory.io[GB_REG_TIMA]) {

mTimingSchedule(&timer->p->timing, &timer->irq, (7 - (timer->p->cpu->executionState & 3)) * tMultiplier); } } - if (timer->internalDiv & 0x200) { + if (timer->internalDiv & (0x200 << timer->p->doubleSpeed)) { GBAudioUpdateFrame(&timer->p->audio); } timer->p->memory.io[GB_REG_DIV] = 0;