From eabee261d32f07e280856a58a619307e384929c9 Mon Sep 17 00:00:00 2001 From: Tom Collins Date: Thu, 25 Mar 2021 15:22:05 -0700 Subject: [PATCH 1/2] BIOS: don't modify MTCR if spectrum spreading disabled There may be instances where we want a non-zero MTCR even if the spectrum spreader is disabled. By leaving it unmodified, it might still be zero from the default startup value, or set non-zero elsewhere. --- Lib/BIOSLIB/CPUPARAM.LIB | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/Lib/BIOSLIB/CPUPARAM.LIB b/Lib/BIOSLIB/CPUPARAM.LIB index 92e5e2c..e5f77c1 100644 --- a/Lib/BIOSLIB/CPUPARAM.LIB +++ b/Lib/BIOSLIB/CPUPARAM.LIB @@ -162,14 +162,7 @@ END DESCRIPTION ***************************************************************/ #asm xmem nodebug _enableClockModulation:: bool hl -#if _CPU_ID_ < R2000_R3 - ld l, h - lret -#elif ENABLE_SPREADER == 0 // spreader disabled - xor a - ld (MTCRShadow), a -; ioi ld (MTCR), a // normal /OE0 and /OE1 timing - IOWRITE_A(MTCR) +#if _CPU_ID_ < R2000_R3 || ENABLE_SPREADER == 0 ld l, h lret #else From b529bc8339571b9900ed69ccc4d9678e9adb3cbe Mon Sep 17 00:00:00 2001 From: Tom Collins Date: Tue, 6 Apr 2021 13:25:12 -0700 Subject: [PATCH 2/2] BIOS: enable early /OE before clock doubler This increases the /OE timing margin for 29MHz products with 55ns flash memory for the brief moment before _enableClockModulation() enables it, and ensures it's still enabled if the spectrum spreader is disabled. --- Lib/BIOSLIB/StdBios.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/Lib/BIOSLIB/StdBios.c b/Lib/BIOSLIB/StdBios.c index 5a4d466..4d2da9c 100644 --- a/Lib/BIOSLIB/StdBios.c +++ b/Lib/BIOSLIB/StdBios.c @@ -2452,12 +2452,19 @@ _more_inits02:: ld hl, GCSRShadow ld (hl), a - lcall _getDoublerSetting - - ld a, l + lcall _getDoublerSetting ; get doubler setting value into L (h always 0) + ld a, L + or a ; update the Zero flag + jr z, .notDoubled + + ld a, 0x0C ; value to set both /OE0 and /OE1 early output + ioi ld (MTCR), a ; first, update /OE0, /OE1 early output enable + ld (MTCRShadow), a + +.notDoubled: + ld a, L ; recover the doubler setting value + ioi ld (GCDR), a ; next, update clock doubler setting ld (GCDRShadow), a - ioi ld (GCDR), a ; set clock doubler now - #if _CPU_ID_ >= R2000_R3 lcall _enableClockModulation ; enables spreader