From 84a1713b5b2d4001cd7bcadd198168c3e584a776 Mon Sep 17 00:00:00 2001 From: 4am Date: Sun, 26 Mar 2023 15:00:07 -0400 Subject: [PATCH] add support for Didatech [fixes Crosscountry USA, Canada, California] --- src/adstyle.a | 6 +++--- src/apicode.a | 4 ++++ src/apidefs.a | 3 ++- src/id/trace33.a | 22 ++++++++++++++++++++++ src/passport.a | 3 ++- src/patchers/didatech.a | 25 +++++++++++++++++++++++++ src/sectormap.a | 1 + src/strings/en.a | 5 +++++ src/strings/enid.a | 1 + 9 files changed, 65 insertions(+), 5 deletions(-) create mode 100644 src/patchers/didatech.a diff --git a/src/adstyle.a b/src/adstyle.a index 5d7e636..207ddbf 100644 --- a/src/adstyle.a +++ b/src/adstyle.a @@ -180,7 +180,7 @@ ADStyle ; + b4bbcompare - lda #$FD ; modified at runtime (in Inspect1) + lda #$FD ; SMC ldx #$00 ldy #$20 jsr CompareMemory @@ -236,10 +236,10 @@ x0 lda $FFC2 ; high byte modified at runtime (above) sta gPossibleB4BBBasic lda #$BB b4bbmodify - sta $FFFF ; modified at runtime (high byte in Inspect1, low byte above) + sta $FFFF ; SMC lda #$DE b4bbmodify2 - sta $FFFF ; modified at runtime (high byte in Inspect1, low byte above) + sta $FFFF ; SMC lda gIsDOS32 bne _b4bbexit lda #kSectorCustomDOS32B4BB diff --git a/src/apicode.a b/src/apicode.a index 8e2a40c..b8d28a1 100644 --- a/src/apicode.a +++ b/src/apicode.a @@ -79,6 +79,10 @@ ; set in IDBootFailure() after reading T00 FIRSTFILTER +;gIsDidatech + !byte FALSE ; 0=true, 1=false + ; reset before each operation + ; set in TraceDOS33c() after tracing DOS 3.3-shaped RWTS ;gIsEnlightenment !byte FALSE ; 0=true, 1=false ; reset before each operation diff --git a/src/apidefs.a b/src/apidefs.a index f636abb..c943b77 100644 --- a/src/apidefs.a +++ b/src/apidefs.a @@ -185,9 +185,10 @@ gPossibleB4BBBasic = gPossibleWoodbury-$01 ; byte gIsLowDOS = gPossibleB4BBBasic-$01 ; byte gIsBaudville = gIsLowDOS-$01 ; byte gIsEnlightenment = gIsBaudville-$01 ; byte +gIsDidatech = gIsEnlightenment-$01 ; byte ;LASTFILTER ; add new gIs* above this line ;gIsInfocom18 is a special case whose ID is not in the regular inspection path -gIsInfocom18 = gIsEnlightenment-$01 ; byte +gIsInfocom18 = gIsDidatech-$01 ; byte ;gIs13Sector is a special case whose ID is not in the regular inspection path gIs13Sector = gIsInfocom18-$01 ; byte ;gMECCFastloadType is a special case integer whose default value cannot be #FALSE diff --git a/src/id/trace33.a b/src/id/trace33.a index ebc275b..eb0c13e 100755 --- a/src/id/trace33.a +++ b/src/id/trace33.a @@ -204,6 +204,28 @@ TraceDOS33c ; 2nd-level trace callback is here sta T02S05 .notMilliken ; +; Check for Didatech decryption routine +; (affects readable/ignoreable sector map, so must ID now) +; + jsr $ff58 + lda MaybeBC + ldx #$E1 + ldy #$0A + jsr CompareMemory + !byte $A2,$04 + !byte $A0,$05 + !byte $A9,$96 + !byte $59,$00,$08 + !byte $99 + bcs .notDidatech ; passport-test-suite/Crosscountry Canada.woz [C=0] matches + jsr PrintByID + !byte s_didatech + lda #kSectorOptional + sta T02S07 + lda #TRUE + sta gIsDidatech +.notDidatech +; ; Try to initialize the 'current track' variable like the bootloader would -- ; required for some disks that use a strange location for this variable ; e.g. Super Taxman II diff --git a/src/passport.a b/src/passport.a index da105d1..449c1c4 100755 --- a/src/passport.a +++ b/src/passport.a @@ -385,7 +385,8 @@ AnalyzeTrack !source "patchers/mak.a" ; gIsBoot0 && T02 only !source "patchers/jsr8635.a" ; gIsBoot0 only !source "patchers/sierra.a" ; gIsBoot0 only - !source "patchers/probs5.a" + !source "patchers/probs5.a" ; gIsBoot0 only + !source "patchers/didatech.a" ; gIsBoot0 && gIsDidatech only _endDOS33Patchers ; ; Diversi-DOS-specific patchers diff --git a/src/patchers/didatech.a b/src/patchers/didatech.a new file mode 100644 index 0000000..b8803f3 --- /dev/null +++ b/src/patchers/didatech.a @@ -0,0 +1,25 @@ +;------------------------------- +; #DIDATECH +; nibble check of malformed T02,S07 +; +; tested on +; - Crosscountry Canada +; - Crosscountry USA +; - Crosscountry California +;------------------------------- + lda gIsDidatech + bne + + + ldy #$09 + jsr SearchTrack; code is XOR #$96 but not tamper-checked + !byte $06,$59 ; BCC -$CF + !byte $8E ; CLC + !byte $36,$68 ; LDY #$FE + !byte $06,$97 ; BCC +$01 + !byte $5E ; INY + !byte $1A ; STY .... + bcs + ; passport-test-suite/Crosscountry Canada.woz [C=0] matches + jsr inx7 + jsr modify1 + !byte $7C ; NOP instead of INY ++ diff --git a/src/sectormap.a b/src/sectormap.a index e8fcb1c..08614e7 100755 --- a/src/sectormap.a +++ b/src/sectormap.a @@ -75,6 +75,7 @@ T01S0F = T01 + $0F T02 = T01 + $10 T02S04 = T02 + $04 T02S05 = T02 + $05 +T02S07 = T02 + $07 T02S0A = T02 + $0A T02S0C = T02 + $0C T02S0F = T02 + $0F diff --git a/src/strings/en.a b/src/strings/en.a index c50cd9b..ba4722d 100755 --- a/src/strings/en.a +++ b/src/strings/en.a @@ -218,6 +218,7 @@ StringTableLow ; must be kept in sync with constants in enid.a !byte <.sfc !byte <.neosoft !byte <.probs5 + !byte <.didatech StringTableHigh ; must be kept in sync with constants in enid.a !byte >.header @@ -375,6 +376,7 @@ StringTableHigh ; must be kept in sync with constants in enid.a !byte >.sfc !byte >.neosoft !byte >.probs5 + !byte >.didatech .passport !text "Passport ",$00 @@ -776,3 +778,6 @@ StringTableHigh ; must be kept in sync with constants in enid.a !text "@",s_found,"Neosoft @",s_protectioncheck,$8D,$00 .probs5 !text "@",s_found,"PROBS5 @",s_protectioncheck,$8D,$00 +.didatech + !text "@",s_found,"Didatech @",s_protectioncheck,$8D + !text "T02,S07 @",s_maybeunreadable,$8D,$00 diff --git a/src/strings/enid.a b/src/strings/enid.a index 2c4752f..147b8bc 100644 --- a/src/strings/enid.a +++ b/src/strings/enid.a @@ -156,3 +156,4 @@ s_enlightenment = $97 s_sfc = $98 s_neosoft = $99 s_probs5 = $9A +s_didatech = $9B