support Interplay Advent games

side A only for now
This commit is contained in:
Peter Ferrie 2018-05-25 21:34:30 -07:00
parent 8ec251bd87
commit b012d335e5
7 changed files with 166 additions and 2 deletions

71
src/id/advent.a Normal file
View File

@ -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
}

View File

@ -140,6 +140,13 @@ IDBootloader
bcs + bcs +
jmp foundea 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 ; Try to identify hybrid 16-/13-sector bootloader on
; DOS 3.2 disks. ; DOS 3.2 disks.
; Exit via custom trace function if found. ; Exit via custom trace function if found.

View File

@ -108,6 +108,7 @@ AnalyzeT00
!source "../patchers/dos32.a" !source "../patchers/dos32.a"
!source "../patchers/dos32dlm.a" !source "../patchers/dos32dlm.a"
!source "../patchers/microfun.a" !source "../patchers/microfun.a"
!source "../patchers/advent.a"
;add only above this line ;add only above this line
rts rts

View File

@ -147,6 +147,7 @@ FirstMover
!source "id/micrograms.a" !source "id/micrograms.a"
!source "id/volumename.a" !source "id/volumename.a"
!source "id/dinkeydos.a" !source "id/dinkeydos.a"
!source "id/advent.a"
!source "print.a" !source "print.a"
!source "compare.a" !source "compare.a"
!source "modify.a" !source "modify.a"

80
src/patchers/advent.a Normal file
View File

@ -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
}

View File

@ -115,6 +115,7 @@ StringTable
!word .trillium !word .trillium
!word .tamper !word .tamper
!word .microfun !word .microfun
!word .advent
; ;
; Text can contain substitution strings, which ; Text can contain substitution strings, which
; are replaced by current values at runtime. Each ; are replaced by current values at runtime. Each
@ -140,7 +141,7 @@ StringTable
; can be set directly before calling PrintByID. ; can be set directly before calling PrintByID.
; ;
.header .header
!text "Passport by 4am 2018-05-08",$00 !text "Passport by 4am 2018-05-25",$00
.mainmenu .mainmenu
!text "________________________________________",$8D,$8D,$8D,$8D,$8D,$8D,$8D !text "________________________________________",$8D,$8D,$8D,$8D,$8D,$8D,$8D
!text " " !text " "
@ -436,4 +437,6 @@ StringTable
!text "T%t,S%0 Found anti-tamper check",$8D,$00 !text "T%t,S%0 Found anti-tamper check",$8D,$00
.microfun .microfun
!text "T%t,S%0 Found Micro Fun protection check",$00 !text "T%t,S%0 Found Micro Fun protection check",$00
.advent
!text "T%t,S%0 Found Interplay protection check",$00
} }

View File

@ -103,4 +103,5 @@ s_dinkeydos = $61
s_trillium = $62 s_trillium = $62
s_tamper = $63 s_tamper = $63
s_microfun = $64 s_microfun = $64
STRINGCOUNT = $65 s_advent = $65
STRINGCOUNT = $66