passport/src/patchers/sierra13.a
2021-06-21 11:57:02 -04:00

190 lines
4.3 KiB
Plaintext

;-------------------------------
; #SIERRA13
; search and disable a self-decrypting
; protection check used on some Sierra
; disks
;
; Cranston Manor
; Jawbreaker
; Missile Defense
; Mission Asteroid
; Pegasus ][
; Threshold
;
; module by qkumba
;-------------------------------
!zone {
lda gIsDOS32
bne .jmpexit
;Cranston Manor/Wizard and the Princess
;secondary protection
ldy #10
jsr SearchTrack
!byte $A9,$24 ;LDA #$24
!byte $8D,$1E,$B9 ;STA $B91E
!byte $A9,$00 ;LDA #$00
!byte $8D,$7F,$89 ;STA $897F
bcs +
inx
inx ;patch the STA
jsr modify1
!byte $AD ;LDA
lda #$24
sta $B91E
.jmpexit
jmp .exit
;Cranston Manor/Wizard and the Princess
;tertiary protection
+ ldy #10
jsr SearchTrack
!byte $A9,$1E ;LDA #$1E
!byte $8D,$7D,$BE ;STA $BE7D
!byte $A9,$BA ;LDA #$BA
!byte $8D,$7E,$BE ;STA $BE7E
bcs +
pha
tay
txa
pha
tya
pha
txa
pha
tya
ldy #10
jsr modify
!byte $A9,$A0 ;LDA #$A0
!byte $8D,$8C,$BE ;STA $BE8C
!byte $A9,$B9 ;LDA #$B9
!byte $8D,$8D,$BE ;STA $BE8D
pla
sec
sbc #$0D
tax
pla
ldy #10
jsr compare
!byte $A9,$85 ;LDA #$85
!byte $8D,$7D,$BE ;STA $BE7D
!byte $A9,$6B ;LDA #$6B
!byte $8D,$7E,$BE ;STA $BE7E
bcs ++
ldy #10
jsr modify
!byte $A9,$A0 ;LDA #$A0
!byte $8D,$8C,$BE ;STA $BE8C
!byte $A9,$B9 ;LDA #$B9
!byte $8D,$8D,$BE ;STA $BE8D
lda #<.swaptrk
sta $BE7D
lda #>.swaptrk
sta $BE7E
++ pla
clc
adc #$48
tax
pla
jsr modify2
!byte $A0,$B9
bvc .jmpexit
.swaptrk
ldy $478
cpy #$c0
beq .swapped
cmp #2
bne .try4
asl
bne .swapped
.try4
cmp #4
bne .swapped
lsr
.swapped
jmp $BA1E
;Threshold secondary protection
+ ldy #11
jsr SearchTrack
!byte $A9,$00 ;LDA #$00
!byte $AA ;TAX
!byte $5D,$00,$96 ;EOR $9600,X
!byte $E8 ;INX
!byte $D0,$FA ;BNE *-4
!byte $C9,$F3 ;CMP #$F3
bcs +
pha
txa
adc #$0A
tax
pla
jsr modify1
!byte $FC
bvc .exit
;Missile Defense
+ ldy #17
jsr SearchTrack
!byte $20,$00,$8F ;JSR $8F00
!byte $20,$00,$90 ;JSR $9000
!byte $20,$00,$8F ;JSR $8F00
!byte $A9,$00 ;LDA #$00
!byte $85,$03 ;STA $03
!byte $A9,$20 ;LDA #$20
!byte $85,$02 ;STA $02
bcs +
jsr PrintByID
!byte s_sierra
inx
inx
inx ;patch the second JSR
jsr modify1
!byte $2C ;LDA
bvc .exit
;Cranston Manor, etc.
+ ldy #14
jsr SearchTrack
!byte $A0,$00 ;LDY #$00
!byte $A9,$55 ;LDA #$55
!byte $59,WILDCARD,WILDCARD ;EOR $xxxx,Y
!byte $99,WILDCARD,WILDCARD ;STA $xxxx,Y
!byte $88 ;DEY
!byte $D0,$F5 ;BNE *-9
!byte $EA ;NOP
bcs .exit
cpx #$50
bcc +
tay
dey ;Pegasus code spans pages
tya
clc
+ sta .adjust+1
adc #BASEPAGE
jsr PrintByID
!byte s_sierra
ldy #8
jsr SearchSector
!byte $85,WILDCARD ;encoded BNE *+xx
!byte $DD ;encoded DEY
!byte WILDCARD,$A0 ;encoded Bxx *-9
!byte $E8,$DD,$95 ;encoded LDA $C088,X
bcs .exit
inx
.adjust lda #$d1
jsr modify1
!byte $55 ;encoded zero
lda #TRUE
sta gIsSierra13
.exit
}