From 7fe893d48abfb0720c11666ab40db5a378a0d860 Mon Sep 17 00:00:00 2001 From: Peter Ferrie Date: Tue, 26 Nov 2019 22:17:22 -0800 Subject: [PATCH] proper FASTChip support --- src/constants.a | 4 ++-- src/hw.accel.a | 51 +++++++++++++++++++++++++++++-------------------- 2 files changed, 32 insertions(+), 23 deletions(-) diff --git a/src/constants.a b/src/constants.a index fd34b7bca..da02376cc 100644 --- a/src/constants.a +++ b/src/constants.a @@ -18,7 +18,7 @@ ; D672..DB6D - HGR font code & ProRWTS glue code ; DB6E..DB7D - backup of stack (during gameplay and self-running demos) ; ...unused... -; DBB6..DBFF - (de)acceleration function +; DBB2..DBFF - (de)acceleration function ; DC00..DFFF - HGR font data ;------------------------------------------------------------------------------ @@ -112,7 +112,7 @@ gCheatsAvailable = $D000 ; master cheats table, indexed by game index in gGam MachineStatus = $FFF9 ; LC RAM 2 -DisableAccelerator = $DBB6 +DisableAccelerator = $DBB2 EnableAccelerator = DisableAccelerator+3 ; AND masks for MachineStatus diff --git a/src/hw.accel.a b/src/hw.accel.a index 2f03cb6c9..b4344ac16 100644 --- a/src/hw.accel.a +++ b/src/hw.accel.a @@ -118,7 +118,8 @@ fc_lock = $C06A FC_UNLOCK = $6A ; write 4 times FC_LOCK = $A6 fc_enable = $C06B -fc_speed = $C06D +fc_config = $C06E +fc_data = $C06F FC_1MHZ = 9 FC_ON = 40 ; doco says 16.6Mhz @@ -193,7 +194,7 @@ maccheck iic ldx romid_c cpx #ROMID_CPLUS - bne build_addon ; not a //c+, eventually hit Zip + bne patch_zc ; not a //c+, eventually hit Zip lda #iicplus @@ -208,6 +209,13 @@ build_setspeed ldx #(end_setspeed-setspeed) rts +patch_zc + lda #$d0 ; BNE + sta zc_iic + lda #(FASTChip-zc_iic)-2 + sta zc_iic+1 + ; fall through + build_addon lda #addon @@ -334,15 +342,26 @@ addon ; TransWarp I sta tw1_speed - ; Zip Chip + ; trademarked accelerator from Germany tay + sta uw_fast,y ; value does not matter + + ; Zip Chip + + ldy #FC_1MHZ eor #1 tax - lda #ZC_UNLOCK + beq + + ldy #FC_ON ++ lda #ZC_UNLOCK php 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 @@ -351,29 +370,19 @@ addon lda #ZC_LOCK sta zc_lock - ;; current products are subject to change so do - ;; 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 +FASTChip lda #FC_UNLOCK sta fc_lock sta fc_lock sta fc_lock sta fc_lock sta fc_enable - stx fc_speed + lda #0 + sta fc_config + sty fc_data lda #FC_LOCK sta fc_lock + plp ; restore interrupt state rts -end_addon +end_addon \ No newline at end of file