From 8de8a3ecdd28bae8f40b283f750cb32da9093208 Mon Sep 17 00:00:00 2001 From: meepingsnesroms Date: Thu, 18 Oct 2018 16:46:12 -0700 Subject: [PATCH] Fix half speed bug --- bugs/missingFunctions.txt | 1 + src/hardwareRegistersTiming.c.h | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/bugs/missingFunctions.txt b/bugs/missingFunctions.txt index f1162e7..034df2a 100644 --- a/bugs/missingFunctions.txt +++ b/bugs/missingFunctions.txt @@ -8,6 +8,7 @@ app install hack needs to be removed when SD card works double pressing power button issue Fixed: +device runs at around half speed for some reason(the SYSCLK divider was not scaled properly) Sound(those cute little PWM beeps) Mac Qt build has no icons QSettings is broken on Windows(this prevents loading the ROM) diff --git a/src/hardwareRegistersTiming.c.h b/src/hardwareRegistersTiming.c.h index a33fb12..2c072db 100644 --- a/src/hardwareRegistersTiming.c.h +++ b/src/hardwareRegistersTiming.c.h @@ -162,10 +162,10 @@ static double dmaclksPerClk32(){ } static double sysclksPerClk32(){ - uint8_t sysclkSelect = registerArrayRead16(PLLCR) >> 8 & 0x0003; + uint8_t sysclkSelect = registerArrayRead16(PLLCR) >> 8 & 0x0007; - //> 4 means run at full speed, no divider - if(sysclkSelect > 4) + //>= 4 means run at full speed, no divider + if(sysclkSelect >= 4) return dmaclksPerClk32(); //divide DMACLK by 2 to the power of PLLCR SYSCLKSEL