passport/src/patchers/errord51.a
2021-06-21 10:33:16 -04:00

51 lines
1.2 KiB
Plaintext

;-------------------------------
; #ERRORD51
; sneaky bad block check sets an error callback
; then expects the RWTS call not to return
; (prints ']ERROR D51' on failure)
;
; tested on
; - Granny Applebee's Cookie Factory
; - Hugo Hound's Vowel Sounds (series)
; - Marty's Family Reader (series)
; - Marty's Reading Workout (series)
; - Uncle Clyde's Consonant Slides (series)
;-------------------------------
ERRORD51
lda gIsLowDOS
bne @exit
ldy #$10
jsr SearchTrack
!byte $A9,WILDCARD
!byte $8D,$07,WILDCARD
!byte $A9,WILDCARD
!byte $8D,$08,WILDCARD
!byte $A9,$01
!byte $8D,WILDCARD,WILDCARD
!byte $20
bcs @exit
pha
clc
adc #BASEPAGE
sta @highBytePtr+2
txa
pha
jsr inx6
stx @highBytePtr+1
jsr PrintByID
!byte s_badblock
pla
tax
pla
jsr modify1
!byte $4C ; JMP opcode
@highBytePtr
ldy $FDFD ; SMC
sty +
inx
inx
jsr modify1
+ !byte $FD ; SMC (high byte of JMP address)
@exit