shithub: plan9front

Download patch

ref: 655170c873633c75694c9014be0dae22ab08b8a9
parent: 827bf1b7da635b1018cbcc515f0ce2c074337629
author: Michael Forney <mforney@mforney.org>
date: Sun Feb 7 22:58:02 EST 2021

games/gb: fix timer divider for input clock 0
According to [0], input clock 0 should divide by 1024=2¹⁰, not 2¹².
This caused audio to run at quarter-speed in one game I tried.

[0] https://gbdev.io/pandocs/#ff07-tac-timer-control-r-w

Tested with zelda: oracle of seasons, and dr. mario
---

--- a/sys/src/games/gb/ev.c
+++ b/sys/src/games/gb/ev.c
@@ -8,7 +8,7 @@
 extern Event evsamp, chev[4];
 Event *events[NEVENT] = {&evhblank, &evtimer, &evenv, &evsamp, &chev[0], &chev[1], &chev[2], &chev[3]};
 Event *elist;
-static int timshtab[4] = {12, 4, 6, 8}, timsh;
+static int timshtab[4] = {10, 4, 6, 8}, timsh;
 ulong timclock;
 Var evvars[] = {VAR(timsh), VAR(timclock), {nil, 0, 0}};