diff --git a/src/id/inspect0.a b/src/id/inspect0.a index 87e222b..e66e76e 100755 --- a/src/id/inspect0.a +++ b/src/id/inspect0.a @@ -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. diff --git a/src/id/mecc.a b/src/id/mecc.a index e533389..4aa8ca3 100755 --- a/src/id/mecc.a +++ b/src/id/mecc.a @@ -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,7 +90,7 @@ IDMECCM8RWTS .exit rts -foundmeccm8 +foundmecc1 ; ; We found an "M8" MECC bootloader. Now we create ; an RWTS that can read the rest of the disk. @@ -92,9 +98,6 @@ foundmeccm8 ; 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,7 +173,7 @@ IDMECCM7RWTS .exit rts -foundmeccm7 +foundmecc2 ; ; We found an "M7" MECC bootloader. Now we create ; an RWTS that can read the rest of the disk. @@ -189,17 +181,13 @@ foundmeccm7 ; 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 "M7" 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 +} diff --git a/src/passport.a b/src/passport.a index 5a6569e..0e62cde 100755 --- a/src/passport.a +++ b/src/passport.a @@ -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" diff --git a/src/patchers/meccm8.a b/src/patchers/mecc1.a similarity index 94% rename from src/patchers/meccm8.a rename to src/patchers/mecc1.a index d92d7e9..88c8098 100755 --- a/src/patchers/meccm8.a +++ b/src/patchers/mecc1.a @@ -8,7 +8,7 @@ _meccm8 jsr IDMECC bcs .exit - jsr IDMECCM8RWTS + jsr IDMECC1 bcs .exit lda #$0B ldx #$08 diff --git a/src/patchers/meccm7.a b/src/patchers/mecc2.a similarity index 94% rename from src/patchers/meccm7.a rename to src/patchers/mecc2.a index 3a573c2..5c958b0 100755 --- a/src/patchers/meccm7.a +++ b/src/patchers/mecc2.a @@ -8,7 +8,7 @@ _meccm7 jsr IDMECC bcs .exit - jsr IDMECCM7RWTS + jsr IDMECC2 bcs .exit lda #$07 ldx #$83 diff --git a/src/patchers/meccm6.a b/src/patchers/mecc3.a similarity index 91% rename from src/patchers/meccm6.a rename to src/patchers/mecc3.a index fa1eda0..e379de5 100644 --- a/src/patchers/meccm6.a +++ b/src/patchers/mecc3.a @@ -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 diff --git a/src/patchers/mecc4.a b/src/patchers/mecc4.a new file mode 100644 index 0000000..545fdf1 --- /dev/null +++ b/src/patchers/mecc4.a @@ -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 +} diff --git a/src/strings/en.a b/src/strings/en.a index 1e6d8c7..f0ed22f 100755 --- a/src/strings/en.a +++ b/src/strings/en.a @@ -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-02-21",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,8 +374,8 @@ 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 @@ -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 }