Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable early /OE in more configurations #8

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions Lib/BIOSLIB/CPUPARAM.LIB
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change ensures that we don't disable "early /OE" if it was previously enabled. Startup default is disabled (0x00), but the StdBios.c change around line 2455 will automatically enable it on all products with a doubled clock, and later code in this function enables it before turning on the spectrum spreader.

ld l, h
lret
#else
Expand Down
17 changes: 12 additions & 5 deletions Lib/BIOSLIB/StdBios.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change, backported from Dynamic C PR 30, enables "early /OE" before enabling the clock doubler.

Note that Dynamic C 9 could use the existing code from that sets MTCR and its shadow to 0 if the clock doubler is disabled, since there isn't any code earlier in the BIOS attempting to set it (as the Dynamic C 10 patch does for the RCM4110).


.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
Expand Down