From b012d335e523d1dc23ace238a7ec9e7f5567eb9b Mon Sep 17 00:00:00 2001 From: Peter Ferrie Date: Fri, 25 May 2018 21:34:30 -0700 Subject: [PATCH] support Interplay Advent games side A only for now --- src/id/advent.a | 71 ++++++++++++++++++++++++++++++++++++++ src/id/inspect0.a | 7 ++++ src/mods/t00only.a | 1 + src/passport.a | 1 + src/patchers/advent.a | 80 +++++++++++++++++++++++++++++++++++++++++++ src/strings/en.a | 5 ++- src/strings/enid.a | 3 +- 7 files changed, 166 insertions(+), 2 deletions(-) create mode 100644 src/id/advent.a create mode 100644 src/patchers/advent.a diff --git a/src/id/advent.a b/src/id/advent.a new file mode 100644 index 0000000..36b640b --- /dev/null +++ b/src/id/advent.a @@ -0,0 +1,71 @@ +;------------------------------- +; IDAdvent +; identify Interplay custom bootloader +; +; in: track buffer contains T00,S00 +; out: C clear if Interplay bootloader was found +; C set if not found +; all other flags clobbered +; all registers clobbered +; +; module by qkumba +;------------------------------- +IDAdvent + lda #BASEPAGE + ldy #33 + jsr SearchSector + !byte $2C,$83,$C0 ;BIT $C083 + !byte $2C,$83,$C0 ;BIT $C083 + !byte $A9,$FF ;LDA #$FF + !byte $8D,$00,$E0 ;STA $E000 + !byte $EE,$00,$E0 ;INC $E000 + !byte $D0,WILDCARD ;BNE $+xx + !byte $A2,$00 ;LDX #$00 + !byte $BD,WILDCARD,$08 ;LDA $08xx,X + !byte $F0,$06 ;BEQ $+8 + !byte $9D,$D8,$07 ;STA $07D8,X + !byte $E8 ;INX + !byte $D0,$F5 ;BNE $-8 + !byte $A6,$2B ;LDX $2B + !byte $4C,$00 ;JMP $xx00 + rts + +foundadvent +; +; We found an Interplay bootloader. Now we create +; an RWTS that can read the rest of the disk. +; Starting with our built-in RWTS, we modify address +; and data prologues based on the parameters of the +; original disk. +; +!zone { + lda #s_advent + jsr PrintByID + jsr CopyUniversal + +;hook read address prologue + lda #<.checktrk + sta $BDC5 + lda #>.checktrk + sta $BDC6 + jmp ADStyle + +.prologtbl1 + !byte $96, $97, $9A, $9B, $9D, $9E, $9F, $A6 + !byte $ED, $EE, $EF, $F2, $F3, $F4, $F5, $F6 + +.prologtbl2 + !byte $ED, $EE, $EF, $F2, $F3, $F4, $FF, $F7 + !byte $96, $A6, $AA, $D5, $DF, $EA, $AE, $FE + +.checktrk + lda gTrack + beq + + and #$0f + tay + lda .prologtbl1, y + sta UNIV_A2 + lda .prologtbl2, y + sta UNIV_A3 ++ jmp $B944 +} diff --git a/src/id/inspect0.a b/src/id/inspect0.a index b4a1918..66bc2e1 100755 --- a/src/id/inspect0.a +++ b/src/id/inspect0.a @@ -140,6 +140,13 @@ IDBootloader bcs + jmp foundea ; +; Try to identify Interplay bootloader. +; Exit via custom trace function if found. +; ++ jsr IDAdvent + bcs + + jmp foundadvent +; ; Try to identify hybrid 16-/13-sector bootloader on ; DOS 3.2 disks. ; Exit via custom trace function if found. diff --git a/src/mods/t00only.a b/src/mods/t00only.a index a94606e..4d2cbcc 100644 --- a/src/mods/t00only.a +++ b/src/mods/t00only.a @@ -108,6 +108,7 @@ AnalyzeT00 !source "../patchers/dos32.a" !source "../patchers/dos32dlm.a" !source "../patchers/microfun.a" + !source "../patchers/advent.a" ;add only above this line rts diff --git a/src/passport.a b/src/passport.a index 21b97ed..f777c07 100755 --- a/src/passport.a +++ b/src/passport.a @@ -147,6 +147,7 @@ FirstMover !source "id/micrograms.a" !source "id/volumename.a" !source "id/dinkeydos.a" + !source "id/advent.a" !source "print.a" !source "compare.a" !source "modify.a" diff --git a/src/patchers/advent.a b/src/patchers/advent.a new file mode 100644 index 0000000..6bb143d --- /dev/null +++ b/src/patchers/advent.a @@ -0,0 +1,80 @@ +;------------------------------- +; #Advent +; patched RWTS +; +; Borrowed Time +; Mindshadow +; Tracer Sanction +; +; module by qkumba +;------------------------------- +!zone { + clc +.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 + ldy #1 + jsr modify + !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 + ldy #3 + jsr modify + !byte $C9,$DE ;CMP #$DE + !byte $EA ;NOP + pla +.patch + ldx #0 + ldy #3 + jsr modify + !byte $C9,$AA ;CMP #$AA + !byte $EA ;NOP + plp + bcs .exit + sec + jmp .again + +.pop + plp +.exit +} diff --git a/src/strings/en.a b/src/strings/en.a index 59a0fdb..a233060 100755 --- a/src/strings/en.a +++ b/src/strings/en.a @@ -115,6 +115,7 @@ StringTable !word .trillium !word .tamper !word .microfun + !word .advent ; ; Text can contain substitution strings, which ; are replaced by current values at runtime. Each @@ -140,7 +141,7 @@ StringTable ; can be set directly before calling PrintByID. ; .header - !text "Passport by 4am 2018-05-08",$00 + !text "Passport by 4am 2018-05-25",$00 .mainmenu !text "________________________________________",$8D,$8D,$8D,$8D,$8D,$8D,$8D !text " " @@ -436,4 +437,6 @@ StringTable !text "T%t,S%0 Found anti-tamper check",$8D,$00 .microfun !text "T%t,S%0 Found Micro Fun protection check",$00 +.advent + !text "T%t,S%0 Found Interplay protection check",$00 } diff --git a/src/strings/enid.a b/src/strings/enid.a index 5e633b2..7d987d8 100644 --- a/src/strings/enid.a +++ b/src/strings/enid.a @@ -103,4 +103,5 @@ s_dinkeydos = $61 s_trillium = $62 s_tamper = $63 s_microfun = $64 -STRINGCOUNT = $65 +s_advent = $65 +STRINGCOUNT = $66