work around IIe card VBL issue

This commit is contained in:
Peter Ferrie 2022-10-04 13:37:33 -07:00
parent f4165fab50
commit f6a55dc181
3 changed files with 41 additions and 7 deletions

View File

@ -1,5 +1,5 @@
;license:MIT
;(c) 2020 by Frank M.
;(c) 2020, 2022 by Frank M., qkumba
!cpu 6502
!to "build/PRELAUNCH.INDEXED/FLAPPLE.BIRD",plain
@ -7,7 +7,20 @@
!source "src/prelaunch/common.a"
jmp $800
+READ_RAM2_NO_WRITE
jsr EnableAccelerator
lda #$60
sta $813
jsr $800
+READ_RAM1_NO_WRITE
lda WaitForVBL
eor #$60
bne @good_vbl ; if VBL disabled in TR
sta $2971 ; then disable VBL in game
@good_vbl
+DISABLE_ACCEL
jmp $2000
!if * > $1C0 {
!error "code is too large, ends at ", *

View File

@ -10,17 +10,23 @@ my_vbl
!source "src/prelaunch/common.a"
+READ_RAM1_NO_WRITE
lda WaitForVBL
cmp #$60
beq @skip_vbl
lda WaitForVBL+1
sta @copy_vbl+1
lda WaitForVBL+2
sta @copy_vbl+2
@skip_vbl
lda MachineStatus
and #CHEATS_ENABLED
php
ldy #0
@copy_vbl
lda $d1d1,y ; SMC
lda WaitForVBL,y
; SMC, default to no VBL
sta my_vbl,y
iny
cmp #$60

View File

@ -15,21 +15,31 @@
and #CHEATS_ENABLED
sta cheat_smc1+1
sta cheat_smc2+1
lda WaitForVBL
cmp #$60
php
+READ_ROM_NO_WRITE
lda #$60
sta $13B8
jsr $1200 ; decompress
lda #<callback1
sta $FE06
lda #<callback2
sta $FD26
lda #>callback1
sta $FE07
sta $FD27
plp
bne @good_vbl
ldx #<callback3
stx $FD6A
sta $FD6B
@good_vbl
jmp $EE00
callback1
lda #<callback2
sta $FD26
lda #>callback2
sta $FD27
cheat_smc1
lda #0
beq +
@ -50,6 +60,11 @@ cheat_smc2
+
rts
callback3
lda #$60 ; if VBL disabled in TR
sta $4ED ; then disable VBL in game
jmp $F924
!if * > $1C0 {
!error "code is too large, ends at ", *
}