This commit is contained in:
Peter Ferrie 2017-03-08 07:13:32 -08:00
commit e3f8d9249e
13 changed files with 325 additions and 133 deletions

View File

@ -141,19 +141,26 @@ IDBootloader
;
jsr IDMECC
bcs .notmecc
jsr IDMECCM8
bcs .notmeccm8
jmp foundmeccm8
.notmeccm8
jsr IDMECCM7
bcs .notmeccm7
jmp foundmeccm7
lda #s_mecc
jsr PrintByID
jsr CopyUniversal
jsr IDMECC1
bcs .notmecc1
jmp foundmecc1
.notmecc1
jsr IDMECC2
bcs .notmecc2
jmp foundmecc2
.notmeccm7
jsr IDMECCM6
bcs .notmeccm6
jmp foundmeccm6
.notmeccm6
.notmecc2
jsr IDMECC3
bcs .notmecc3
jmp foundmecc3
.notmecc3
jsr IDMECC4
bcs .notmecc4
jmp foundmecc4
.notmecc4
.notmecc
;
; Try to identify the encrypted Datasoft bootloader.

View File

@ -2,15 +2,18 @@
; IDMECC
; identify MECC custom bootloader
; note: there are several MECC RWTSes that share
; the same bootloader, so further checks will be
; required to distinguish between them
; the same early bootloader, so further checks
; are required to distinguish between them after
; this function matches
;
; in: track buffer contains T00,S00
; out: C clear if MECC bootloader was found
; (and track buffer now contains all of track 0)
; C set if not found
; all other flags clobbered
; all registers clobbered
;-------------------------------
!zone {
IDMECC
lda #$00
ldx #$00
@ -19,34 +22,37 @@ IDMECC
!byte $01,$4C,$1A,$08,$17,$0F,$00,$00
!byte $0D,$0B,$09,$07,$05,$03,$01,$0E
!byte $0C,$0A,$08,$06,$04,$02,$0F
bcs .exit
lda #$00
sta gTrack
sta gAddress
lda #$0F
sta gSector
clc
adc #BASEPAGE
sta gAddress+1
- jsr ReadSector
bcs .exit
dec gAddress+1
dec gSector
bne -
.exit
rts
}
;-------------------------------
; IDMECCM8
; identify MECC "M8" bootloader
; IDMECC1
; identify MECC bootloader variant #1
; (labeled "M8" on original disks)
;
; in: track buffer contains T00,S00
; in: track buffer contains all of track 0
; out: C clear if MECC "M8" bootloader was found
; C set if not found
; all other flags clobbered
; all registers clobbered
;-------------------------------
!zone {
IDMECCM8
lda #$00
sta gTrack
sta gAddress
lda #$0B
sta gSector
clc
adc #BASEPAGE
sta gAddress+1
jsr ReadSector
bcs .exit
; This entry point is also called by the meccm8 patcher
; in lieu of keeping a global variable around.
IDMECCM8RWTS
IDMECC1
lda #$0B
ldx #$02
ldy #$06
@ -84,17 +90,14 @@ IDMECCM8RWTS
.exit
rts
foundmeccm8
foundmecc1
;
; We found an "M8" MECC bootloader. Now we create
; We found a MECC 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.
;
lda #s_meccb0
jsr PrintByID
jsr CopyUniversal
lda #$00
sta modsrc
lda #$0B
@ -124,31 +127,20 @@ foundmeccm8
}
;-------------------------------
; IDMECCM7
; identify MECC "M7" bootloader
; IDMECC2
; identify MECC bootloader variant #2
; (labeled "M7" on original disks)
;
; in: track buffer contains T00,S00
; in: track buffer contains all of track 0
; out: C clear if MECC "M7" bootloader was found
; C set if not found
; all other flags clobbered
; all registers clobbered
;-------------------------------
!zone {
IDMECCM7
lda #$00
sta gTrack
sta gAddress
lda #$07
sta gSector
clc
adc #BASEPAGE
sta gAddress+1
jsr ReadSector
bcs .exit
; This entry point is also called by the meccm7 patcher
; in lieu of keeping a global variable around.
IDMECCM7RWTS
IDMECC2
lda #$07
IDMECC4a
ldx #$7D
ldy #$06
jsr compare ; IF T00,S07,$7D ==
@ -181,25 +173,21 @@ IDMECCM7RWTS
.exit
rts
foundmeccm7
foundmecc2
;
; We found an "M7" MECC bootloader. Now we create
; We found a MECC 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.
;
lda #s_meccm7
jsr PrintByID
jsr CopyUniversal
lda #$00
sta modsrc
lda #$07
foundmecc4a
clc
adc #BASEPAGE
sta modsrc+1
lda #$00
sta modsrc
ldy #$83
lda (modsrc),y
lsr
@ -223,34 +211,18 @@ foundmeccm7
}
;-------------------------------
; IDMECCM6
; identify MECC "M6" bootloader
; IDMECC3
; identify MECC bootloader (M7 variant
; found in Word Muncher v1.1 and others)
;
; in: track buffer contains T00,S00
; out: C clear if MECC "M6" bootloader was found
; in: track buffer contains all of track 0
; out: C clear if this MECC bootloader variant was found
; C set if not found
; all other flags clobbered
; all registers clobbered
;-------------------------------
!zone {
IDMECCM6
lda #$00
sta gTrack
sta gAddress
lda #$0B
sta gSector
clc
adc #BASEPAGE
sta gAddress+1
jsr ReadSector
bcs .exit
dec gSector
dec gAddress+1
jsr ReadSector
bcs .exit
; This entry point is also called by the meccm6 patcher
; in lieu of keeping a global variable around.
IDMECCM6RWTS
IDMECC3
lda #$0A
ldx #$E2
ldy #$06
@ -285,19 +257,14 @@ IDMECCM6RWTS
.exit
rts
foundmeccm6
foundmecc3
;
; We found an "M6" MECC bootloader. Now we create
; We found a MECC 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.
;
lda #s_meccm6
jsr PrintByID
jsr CopyUniversal
lda #$00
sta modsrc
lda #$0A
@ -326,3 +293,33 @@ foundmeccm6
sta $B8FC
jmp ADStyle
}
;-------------------------------
; IDMECC4
; identify MECC bootloader variant #4
; (labeled "M8" on original disks)
; same as variant #2 but everything is
; on T00,S08 instead of T00,S07
;
; in: track buffer contains all of track 0
; out: C clear if MECC bootloader was found
; C set if not found
; all other flags clobbered
; all registers clobbered
;-------------------------------
!zone {
IDMECC4
lda #$08
jmp IDMECC4a
foundmecc4
;
; We found a MECC 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.
;
lda #$08
jmp foundmecc4a
}

View File

@ -60,11 +60,13 @@ _Inspect1a
clc
adc #$06
sta b4bbcompare+1
sec
sbc #$02
sta .x3+1
sta .x4+1
sta callrwts+2
tax
dex
stx .x5+1
dex
stx .x3+1
stx .x4+1
stx callrwts+2
jsr ProtectedDOS ; check for a specific (encrypted)
; bootloader called "Protected DOS"
bcs .notprotdos
@ -96,7 +98,7 @@ _Inspect1a
ldy #$02
jsr CompareMemory
!byte $20,00
bcc +
bcc .x5
;
; Check for RWTS variant that has extra code before
; JSR $B800 e.g. Verb Viper (DLM), Advanced Analogies (Hartley)
@ -106,7 +108,19 @@ _Inspect1a
ldy #$02
jsr CompareMemory
!byte $20,00
bcc +
bcc .x5
jmp UseUniversal ; give up tracing; this RWTS is unsupported
;
; Check for RWTS variant that uses non-standard address for slot
; LDX $1FE8 e.g. Pinball Construction Set (1983)
; we don't like that one
;
.x5 lda #$FF ; check for "LDX $1FE8" at $BE43
ldx #$43
ldy #$03
jsr CompareMemory
!byte $AE,$E8,$1F
bcs +
jmp UseUniversal ; give up tracing; this RWTS is unsupported
+ jmp ADStyle ; use this RWTS to read the disk

View File

@ -670,9 +670,10 @@ _applyToT00
!source "patchers/bademu.a"
!source "patchers/bademu2.a"
!source "patchers/rwts.a"
!source "patchers/meccm8.a"
!source "patchers/meccm7.a"
!source "patchers/meccm6.a"
!source "patchers/mecc1.a"
!source "patchers/mecc2.a"
!source "patchers/mecc3.a"
!source "patchers/mecc4.a"
!source "patchers/rol1e.a"
!source "patchers/jmpb4bb.a"
!source "patchers/jmpb4bbhi.a"
@ -696,6 +697,7 @@ _applyToAll
!source "patchers/a5count.a"
!source "patchers/d5d5f7.a"
!source "patchers/prodosrwts.a"
!source "patchers/prodos6a.a"
!source "patchers/prodosmecc.a"
!source "patchers/rwtsswapmecc.a"
!source "patchers/protecteddos.a"

View File

@ -15,19 +15,17 @@ _a6bc95
!byte $C9,$A6 ; CMP #$A6
!byte $D0,$ED ; BNE -$ED
bcs .exit
ldy #$09
ldy #$07
jsr SearchTrack
!byte $BD,$8C,$C0; LDA $C08C,X
!byte $10,$FB ; BPL -$FB
!byte $C9,$BC ; CMP #$BC
!byte $D0,$E4 ; BNE -$E4
bcs .exit
ldy #$09
ldy #$07
jsr SearchTrack
!byte $BD,$8C,$C0; LDA $C08C,X
!byte $10,$FB ; BPL -$FB
!byte $C9,$95 ; CMP #$95
!byte $D0,$DB ; BNE -$DB
bcs .exit
ldy #$0E
jsr SearchTrack

View File

@ -177,6 +177,37 @@ _ea
jsr modify
!byte $00 ;new checksum value for cmp
+ ldy #9
jsr SearchTrack
!byte $20,$84,$6E ;JSR $6E84
!byte $A5,$11 ;LDA $11
!byte $C9,$52 ;CMP #$52
!byte $F0,$03 ;BEQ +$03
bcs +
inx
inx
inx
inx
inx
inx
ldy #1
jsr modify
!byte $50 ;new checksum value for cmp
+ ldy #7
jsr SearchTrack
!byte $20,$86,$6E ;JSR $6E86
!byte $C9,$52 ;CMP #$52
!byte $D0,$DB ;BNE -$DB
bcs +
inx
inx
inx
inx
ldy #1
jsr modify
!byte $50 ;new checksum value for cmp
+ ldy #12
jsr SearchTrack
!byte $20,$3E,$91 ;JSR $913E
@ -225,7 +256,7 @@ _ea
!byte $05,$CC,$DC ;JSRA $05cf
!byte $04,$EB,$19 ;LDA $c0e8
!byte $04,$E1,$DE ;LDA $07e2
bcs .exit
bcs +
pha
txa
adc #21
@ -235,6 +266,44 @@ _ea
jsr modify
!byte $E0 ;lda from known-zero instead
+ ldy #23
jsr SearchTrack
!byte $03,$4C ;LDI #$00
!byte $07,$E1,$DE ;STA $07e2
!byte $04,$CC,$DC ;JSRA $05cf
!byte $04,$CC,$DC ;JSRA $05cf
!byte $04,$CC,$DC ;JSRA $05cf
!byte $04,$CC,$DC ;JSRA $05cf
!byte $05,$EB,$19 ;LDA $c0e8
!byte $05,$E1,$DE ;LDA $07e2
bcs +
pha
txa
adc #21
tax
pla
ldy #1
jsr modify
!byte $E0 ;lda from known-zero instead
+ ldy #16
jsr SearchTrack
!byte $49,$4E ;EOR #$4E
!byte $09,$2B ;ORA #$2B
!byte $48 ;PHA
!byte $A9,$04 ;LDA #$04
!byte $48 ;PHA
!byte $A5,$4F ;LDA $4F
!byte $45,$4F ;EOR $4F
!byte $18 ;CLC
!byte $E9,$00 ;SBC #$00
!byte $48 ;PHA
bcs .exit
inx
ldy #1
jsr modify
!byte $E8 ;new checksum value for eor
.dostitles
lda gIsBoot0
bne .exit

View File

@ -8,7 +8,7 @@
_meccm8
jsr IDMECC
bcs .exit
jsr IDMECCM8RWTS
jsr IDMECC1
bcs .exit
lda #$0B
ldx #$08

View File

@ -8,7 +8,7 @@
_meccm7
jsr IDMECC
bcs .exit
jsr IDMECCM7RWTS
jsr IDMECC2
bcs .exit
lda #$07
ldx #$83

View File

@ -1,14 +1,14 @@
;-------------------------------
; #MECCM6
; #MECC3
; MECC fastloader with custom
; address and data prologues
; e.g. early versions of Word Munchers
; e.g. Word Munchers v1.1
;-------------------------------
!zone {
_meccm6
_mecc3
jsr IDMECC
bcs .exit
jsr IDMECCM6RWTS
jsr IDMECC3
bcs .exit
lda #$0A
ldx #$E8

73
src/patchers/mecc4.a Normal file
View File

@ -0,0 +1,73 @@
;-------------------------------
; #MECC4
; MECC fastloader with custom
; address and data prologues
; e.g. A-201 Conquering Whole Numbers
;-------------------------------
!zone {
_mecc4
jsr IDMECC
bcs .exit
jsr IDMECC4
bcs .exit
lda #$08
ldx #$83
ldy #$01
jsr compare ; if T00,S08,$83 !=
!byte $D5
bcc .addr2
ldy #$01
jsr modify ; then set T00,S08,$83 =
!byte $D5
.addr2
lda #$08
ldx #$8D
ldy #$01
jsr compare ; if T00,S08,$8D !=
!byte $AA
bcc .addr3
ldy #$01
jsr modify ; then set T00,S08,$8D =
!byte $AA
.addr3
lda #$08
ldx #$98
ldy #$01
jsr compare ; if T00,S08,$98 !=
!byte $96
bcc .data1
ldy #$01
jsr modify ; then set T00,S08,$98 =
!byte $96
.data1
lda #$08
ldx #$15
ldy #$01
jsr compare ; if T00,S08,$15 !=
!byte $D5
bcc .data2
ldy #$01
jsr modify ; then set T00,S08,$15 =
!byte $D5
.data2
lda #$08
ldx #$1F
ldy #$01
jsr compare ; if T00,S08,$1F !=
!byte $AA
bcc .data3
ldy #$01
jsr modify ; then set T00,S08,$1F =
!byte $AA
.data3
lda #$08
ldx #$2A
ldy #$01
jsr compare ; if T00,S08,$2A !=
!byte $AD
bcc .exit
ldy #$01
jsr modify ; then set T00,S08,$2A =
!byte $AD
.exit
}

38
src/patchers/prodos6a.a Normal file
View File

@ -0,0 +1,38 @@
;-------------------------------
; #PRODOS6A
; disk allows either $D4 or $D5 for the
; first address prologue nibble
; (no patches required, but we want to
; log it)
;-------------------------------
!zone {
prodos6a
lda gIsProDOS ; only if ProDOS (separate check for DOS)
bne .exit
lda #$0F
sta .sector+1
.sector lda #$FF ; modified at runtime
sta gDisplayBytes
ldx #$A5
ldy #$08
jsr compare
!byte $BD,$8C,$C0,$10,$FB,$4A,$C9,$6A
bcs +
lda #s_lsr6a
jsr PrintByID
inc gPatchCount
+
lda .sector+1
ldx #$EF
ldy #$07
jsr compare
!byte $48,$68,$BD,$8C,$C0,$C9,$08
bcs .nextsector
lda #s_bcs08
jsr PrintByID
inc gPatchCount
.nextsector
dec .sector+1
bpl .sector
.exit
}

View File

@ -634,6 +634,7 @@ rwtspatcher
lda gIsRWTS ; if DOS 3.3 RWTS
bne .lsr6a
lda #$03
sta gDisplayBytes
ldx #$4F
ldy #$0A
jsr compare ; and T00,S03,$4F ==
@ -654,6 +655,7 @@ rwtspatcher
lda gIsRWTS ; if DOS 3.3 RWTS
bne .bcs08
lda #$03
sta gDisplayBytes
ldx #$8B
ldy #$15
jsr compare ; and T00,S03,$8B ==

View File

@ -53,7 +53,7 @@ s_modifyto = $22
s_dosb0 = $23
s_prodosb0 = $24
s_pascalb0 = $25
s_meccb0 = $26
s_mecc = $26
s_sierra = $27
s_a6bc95 = $28
s_jmpbcf0 = $29
@ -68,7 +68,7 @@ s_thunder = $31
s_jmpae8e = $32
s_diskvol = $33
s_d5d5f7 = $34
s_meccm7 = $35
s_construct= $35
s_datasoftb0 = $36
s_datasoft = $37
s_lsr6a = $38
@ -89,9 +89,7 @@ s_eab0 = $46
s_eatrk6 = $47
s_eeef = $48
s_poke = $49
s_construct= $4A
s_meccm6 = $4B
STRINGCOUNT = $4C
STRINGCOUNT = $4A
!zone {
StringTable
@ -133,7 +131,7 @@ StringTable
!word .dosboot0
!word .prodosboot0
!word .pascalboot0
!word .meccboot0
!word .mecc
!word .sierra
!word .a6bc95
!word .jmpbcf0
@ -148,7 +146,7 @@ StringTable
!word .jmpae8e
!word .diskvol
!word .d5d5f7
!word .meccm7
!word .construct
!word .datasoftb0
!word .datasoft
!word .lsr6a
@ -169,8 +167,6 @@ StringTable
!word .eatrk6
!word .eeef
!word .poke
!word .construct
!word .meccm6
;
; Text can contain substitution strings, which
; are replaced by current values at runtime. Each
@ -196,7 +192,7 @@ StringTable
; can be set directly before calling PrintByID.
;
.header
!text "Passport by 4am 2017-02-20",00
!text "Passport by 4am 2017-03-04",00
.mainmenu
!text "________________________________________",$8D,$8D,$8D,$8D,$8D,$8D,$8D
!text " "
@ -335,8 +331,8 @@ StringTable
!text "T00,S00 Found ProDOS bootloader",$8D,00
.pascalboot0
!text "T00,S00 Found Pascal bootloader",$8D,00
.meccboot0
!text "T00 Found MECC M8 bootloader",$8D,00
.mecc
!text "T00,S00 Found MECC bootloader",$8D,00
.sierra
!text "T%t,S%0 Found Sierra protection check",$8D,00
.a6bc95
@ -378,17 +374,17 @@ StringTable
!text "disk volume number.",$8D,00
.d5d5f7
!text "T%t,S%0 Found D5D5F7 protection check",$8D,00
.meccm7
!text "T00 Found MECC M7 bootloader",$8D,00
.construct
!text "T01,S0F Reconstructing missing data",$8D,$00
.datasoftb0
!text "T00,S00 Found Datasoft bootloader",$8D,00
.datasoft
!text "T%t,S%0 Found Datasoft protection check",$8D,00
.lsr6a
!text "T00,S03 RWTS accepts $D4 or $D5 for the",$8D
!text "T%t,S%0 RWTS accepts $D4 or $D5 for the",$8D
!text "first address prologue nibble.",$8D,00
.bcs08
!text "T00,S03 RWTS accepts $DE or a timing bit"
!text "T%t,S%0 RWTS accepts $DE or a timing bit"
!text "for the first address epilogue nibble.",$8D,00
.jmpb660
!text "T00,S02 RWTS requires timing bits after",$8D
@ -431,8 +427,4 @@ StringTable
.poke
!text "T%t,S%0 BASIC program POKEs protection",$8D
!text "check into memory and CALLs it.",$8D,$00
.construct
!text "T01,S0F Reconstructing missing data",$8D,$00
.meccm6
!text "T00 Found MECC M6 bootloader",$8D,00
}