passport/src/patchers/advent.a
2021-07-11 01:15:12 -04:00

90 lines
2.8 KiB
Plaintext

;-------------------------------
; #Advent
; patched RWTS
;
; Borrowed Time
; Mindshadow
; Tracer Sanction
;
; module by qkumba
;-------------------------------
!zone {
lda gIsAdvent
bne .exit
;carry controls how many times to run on one track
;Mindshadow and Tracer Sanction have two copies
;of the protection on track 0, loaded to two
;different addresses at different stages of play
lda gTrack
cmp #1
.again php
ldy #29
jsr SearchTrack
!byte $F0,$10 ;BEQ $+12
!byte $29,$0F ;AND #$0F
!byte $A8 ;TAY
!byte $B9,WILDCARD,WILDCARD ;LDA $xxxx,Y
!byte $8D,WILDCARD,WILDCARD ;STA $xxxx
!byte $B9,WILDCARD,WILDCARD ;LDA $xxxx,Y
!byte $8D,WILDCARD,WILDCARD ;STA $xxxx
!byte $60 ;RTS
!byte $A9,$AA ;LDA #$AA
!byte $8D,WILDCARD,WILDCARD ;STA $xxxx
!byte $A9,$96 ;LDA #$96
!byte $8D,WILDCARD,WILDCARD ;STA $xxxx
!byte $60 ;RTS
bcs .pop ; passport-test-suite/Borrowed Time.woz [C=0] matches
; passport-test-suite/Mindshadow.woz [C=0] matches
; passport-test-suite/The Tracer Sanction.woz [C=0] matches
jsr modify1
!byte $10 ;BEQ -> BPL
ldy #23
jsr SearchTrack
!byte $A4,WILDCARD ;LDY $xx
!byte $BD,$8C,$C0 ;LDA $C08C,X
!byte $10,$FB ;BPL $-3
!byte $D9,WILDCARD,WILDCARD ;CMP $xxxx,Y
!byte $D0,$AB ;BNE $-53
!byte $EA ;NOP
!byte $BD,$8C,$C0 ;LDA $C08C,X
!byte $10,$FB ;BPL $-3
!byte $D9,WILDCARD,WILDCARD ;CMP $xxxx,Y
!byte $D0,$A0 ;BNE $-5E
bcs .pop
pha
txa
adc #7
tax
pla
adc #0
pha
txa
adc #11
sta .patch+1
pla
tay
adc #0
pha
tya
jsr modify3
!byte $C9,$DE ;CMP #$DE
!byte $EA ;NOP
pla
.patch
ldx #0 ; passport-test-suite/Borrowed Time.woz [Z=1] reaches here
jsr modify3
!byte $C9,$AA ;CMP #$AA
!byte $EA ;NOP
plp
bcs .exit
sec ; passport-test-suite/Mindshadow.woz [C=0] reaches here
bcs .again ; passport-test-suite/The Tracer Sanction.woz [C=1] reaches here
.pop
plp
.exit
}