passport/src/patchers/t00_bb03.a

114 lines
3.7 KiB
Plaintext
Executable File

;-------------------------------
; #BB03
; boot1 calls $BB03 for a self-decrypting nibble check
;
; variant 1a (JSR $BB03, push $B518)
; - Classifying Animals with Backbones
; - EduCalc
;
; variant 1b (JSR $BB03, push $B519)
; - Spanish for Mastery
;
; variant 2 (JSR $BB03 but David-DOS)
; - Case of the Great Train Robbery
; - Case of the Missing Chick
; - Mrs. Wigglesworth's Secret
; - Mystery of the Witch's Shoes
;
; variant 3a (JMP $BB03)
; - Alice in Wonderland (some versions)
; - Sum Ducks
; - Trivia Fever
;
; variant 3b (JMP $BB03 but no whole track count)
; - Pacific 231
;-------------------------------
!zone {
lda #$07 ; sector to check for David-DOS variant
ldy gIsDavidDOS
beq .check
ldy gIsBoot0 ; if DOS 3.3 boot0 loader
beq +
jmp .exit
+
lda #$05 ; sector to check for DOS 3.3 variant
.check ldx #$03
jsr compare3 ; if T00,S0(5|7),$03 ==
!byte $4E,$06,$BB
bcs .exit
jsr PrintByID
!byte s_bb03
ldy gIsDavidDOS
beq .variant2
lda #$01
ldx #$38
jsr compare3 ; if T00,S01,$38 ==
!byte $20,$03,$BB; JSR $BB03
bcc .variant1
jsr compare3 ; if T00,S01,$38 ==
!byte $4C,$03,$BB; JMP $BB03
bcs .exit
lda #$05
ldx #$6B
tay
jsr compare ; and T00,S05,$6B ==
!byte $06,$26,$7D; encrypted, decrypts to 'LDA $C08C,X / BPL -'
!byte $39,$41
bcc .variant3a
ldx #$65
jsr compare ; or T00,S05,$65 ==
!byte $A3,$BC
!byte $BD,$30,$99; encrypted, decrypts to 'LDY #$05 / LDA $C08C,X'
bcs .exit
.variant3b
inx
jsr modify3 ; then set T00,S05,$66 =
!byte $B9,$F0,$85; encrypted, decrypts to '#$00 / BEQ +$39'
; which will set Y to 0 (required) and branch to $BBA2
; to finish setting side effects and continue on success path
; passport-test-suite/Pacific 231.woz [V=0] reaches here
bvc .exit ; always branches
.variant3a
jsr modify2 ; then set T00,S05,$6B =
!byte $6B,$F6 ; encrypted, decrypts to 'BNE +$5C' which will unconditionally branch to success path at $BBC9
lda #$06
ldx #$0F
jsr modify1 ; and set T00,S06,$0F =
!byte $89 ; encrypted, decrypts to $10 which is the expected nibble count value
; passport-test-suite/Trivia Fever.woz [V=0] reaches here
bvc .exit ; unconditional branch (V is always 0 coming out of modify)
.variant1
lda $1243
eor $1543
sta + ; calculate entry point of success path (usually #$18 but sometimes #$19)
lda #$05
ldx #$03
ldy #$09
jsr modify ; then set T00,S05,$03 =
!byte $A9,$B5
!byte $48
!byte $A9
+ !byte $FD ; SMC
!byte $48
!byte $4C,$93,$B7
; passport-test-suite/Classifying Animals with Backbones.woz [V=0] reaches here
bvc .exit ; unconditional branch (V is always 0 coming out of modify)
.variant2
ldx #$03 ; passport-test-suite/Case of the Great Train Robbery.woz [Z=0] reaches here
ldy #$0B
jsr modify ; then set T00,S07,$03 =
!byte $A9,$B5
!byte $48
!byte $A9,$18
!byte $48
!byte $A0,$04
!byte $4C,$A9,$B7
.exit
}