Skip to content

Commit

Permalink
Increase lead in time for gathering clock statistics, fixing incorrec…
Browse files Browse the repository at this point in the history
…t clocks an error in many games on the Game Boy Pocket.
  • Loading branch information
Staacks committed Jan 14, 2023
1 parent 84629d5 commit 29afc1a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion firmware/cpubus.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "hardware/structs/systick.h"

uint32_t cycleRatio; //Ratio of rp2040 cycles to Game Boy cycles.
#define CYCLE_RATIO_STATISTIC_SKIP 250 //How many cycles to skip before building the statistic
#define CYCLE_RATIO_STATISTIC_SIZE 1000 //How many cycles to capture as a statistic for cycleRatio

PIO busPIO;
Expand Down Expand Up @@ -231,7 +232,7 @@ void handleMemoryBus() { //To be executed on second core
reset();

//Wait for game to actually start and use this to determine the cycleRatio
uint leadIn = 100; //Skip first cycles in case something funny triggered a few extras while turning on.
uint leadIn = CYCLE_RATIO_STATISTIC_SKIP; //Skip first cycles in case something funny triggered a few extras while turning on.
uint count = CYCLE_RATIO_STATISTIC_SIZE;
systick_hw->rvr = 0x00FFFFFF;
systick_hw->csr = 0x4;
Expand Down
2 changes: 1 addition & 1 deletion firmware/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
#define LED_SWITCH_PIN 1
#define LED_PIN_MASK 0x02

#define VERSION "1.0.4-alpha1"
#define VERSION "1.0.4-alpha2"

#endif

0 comments on commit 29afc1a

Please sign in to comment.