proper FASTChip support

This commit is contained in:
Peter Ferrie 2019-11-26 22:17:22 -08:00
parent e600044bc5
commit 7fe893d48a
2 changed files with 32 additions and 23 deletions

View File

@ -18,7 +18,7 @@
; D672..DB6D - HGR font code & ProRWTS glue code ; D672..DB6D - HGR font code & ProRWTS glue code
; DB6E..DB7D - backup of stack (during gameplay and self-running demos) ; DB6E..DB7D - backup of stack (during gameplay and self-running demos)
; ...unused... ; ...unused...
; DBB6..DBFF - (de)acceleration function ; DBB2..DBFF - (de)acceleration function
; DC00..DFFF - HGR font data ; DC00..DFFF - HGR font data
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
@ -112,7 +112,7 @@ gCheatsAvailable = $D000 ; master cheats table, indexed by game index in gGam
MachineStatus = $FFF9 MachineStatus = $FFF9
; LC RAM 2 ; LC RAM 2
DisableAccelerator = $DBB6 DisableAccelerator = $DBB2
EnableAccelerator = DisableAccelerator+3 EnableAccelerator = DisableAccelerator+3
; AND masks for MachineStatus ; AND masks for MachineStatus

View File

@ -118,7 +118,8 @@ fc_lock = $C06A
FC_UNLOCK = $6A ; write 4 times FC_UNLOCK = $6A ; write 4 times
FC_LOCK = $A6 FC_LOCK = $A6
fc_enable = $C06B fc_enable = $C06B
fc_speed = $C06D fc_config = $C06E
fc_data = $C06F
FC_1MHZ = 9 FC_1MHZ = 9
FC_ON = 40 ; doco says 16.6Mhz FC_ON = 40 ; doco says 16.6Mhz
@ -193,7 +194,7 @@ maccheck
iic iic
ldx romid_c ldx romid_c
cpx #ROMID_CPLUS cpx #ROMID_CPLUS
bne build_addon ; not a //c+, eventually hit Zip bne patch_zc ; not a //c+, eventually hit Zip
lda #<iicplus lda #<iicplus
ldy #>iicplus ldy #>iicplus
@ -208,6 +209,13 @@ build_setspeed
ldx #(end_setspeed-setspeed) ldx #(end_setspeed-setspeed)
rts rts
patch_zc
lda #$d0 ; BNE
sta zc_iic
lda #(FASTChip-zc_iic)-2
sta zc_iic+1
; fall through
build_addon build_addon
lda #<addon lda #<addon
ldy #>addon ldy #>addon
@ -334,15 +342,26 @@ addon
; TransWarp I ; TransWarp I
sta tw1_speed sta tw1_speed
; Zip Chip ; trademarked accelerator from Germany
tay tay
sta uw_fast,y ; value does not matter
; Zip Chip
ldy #FC_1MHZ
eor #1 eor #1
tax tax
lda #ZC_UNLOCK beq +
ldy #FC_ON
+ lda #ZC_UNLOCK
php php
sei ; timing sensitive sei ; timing sensitive
sta zc_lock
zc_iic
sta zc_lock ; SMC
; no blind Zip Chip on the IIc
; it has unwanted side-effects
sta zc_lock sta zc_lock
sta zc_lock sta zc_lock
sta zc_lock sta zc_lock
@ -351,29 +370,19 @@ addon
lda #ZC_LOCK lda #ZC_LOCK
sta zc_lock sta zc_lock
;; current products are subject to change so do FASTChip
;; these last
; trademarked accelerator from Germany
sta uw_fast,y ; value does not matter
; FASTChip
ldx #FC_1MHZ
tya
bne fcset
ldx #FC_ON ; enable set speed?
fcset
lda #FC_UNLOCK lda #FC_UNLOCK
sta fc_lock sta fc_lock
sta fc_lock sta fc_lock
sta fc_lock sta fc_lock
sta fc_lock sta fc_lock
sta fc_enable sta fc_enable
stx fc_speed lda #0
sta fc_config
sty fc_data
lda #FC_LOCK lda #FC_LOCK
sta fc_lock sta fc_lock
plp ; restore interrupt state plp ; restore interrupt state
rts rts
end_addon end_addon