diff --git a/src/apicode.a b/src/apicode.a index 1180c0f..d65be58 100644 --- a/src/apicode.a +++ b/src/apicode.a @@ -49,6 +49,10 @@ ; compile-time flag, no way to change at runtime FIRSTFILTER +;gIsPanglosDOS + !byte FALSE ; 0=true, 1=false + ; reset before each operation + ; set in IDBootloader() after reading T00,S00 ;gIsAdvent !byte FALSE ; 0=true, 1=false ; reset before each operation diff --git a/src/apidefs.a b/src/apidefs.a index c789ca8..b333123 100644 --- a/src/apidefs.a +++ b/src/apidefs.a @@ -88,9 +88,10 @@ gIsTrillium = gIsF7F6-$01 ; byte gPolarwareTamperCheck = gIsTrillium-$01 ; byte gForceDiskVol = gPolarwareTamperCheck-$01 ; byte gIsAdvent = gForceDiskVol-$01 ; byte +gIsPanglosDOS = gIsAdvent-$01 ; byte ;LASTFILTER ; add new gIs* above this line -gOnAClearDayYouCanReadForever = gIsAdvent-$01 ; byte +gOnAClearDayYouCanReadForever = gIsPanglosDOS-$01 ; byte gUsingRAMDisk = gOnAClearDayYouCanReadForever-$01 ; byte gRAMDiskRef = gUsingRAMDisk-$01 ; byte gDisplayBytes = gRAMDiskRef-$0A ; 10 bytes @@ -156,8 +157,9 @@ ConstructStandardDelivery = jConstructStandardDelivery !warn "gIsTrillium=",gIsTrillium !warn "gPolarwareTamperCheck=",gPolarwareTamperCheck !warn "gForceDiskVol=",gIsForceDiskVol -!warn "gOnAClearDayYouCanReadForever=",gOnAClearDayYouCanReadForever !warn "gIsAdvent=",gIsAdvent +!warn "gIsPanglosDOS=",gIsPanglosDOS +!warn "gOnAClearDayYouCanReadForever=",gOnAClearDayYouCanReadForever !warn "gUsingRAMDisk=",gUsingRAMDisk !warn "gRAMDiskRef=",gRAMDiskRef !warn "gDisplayBytes=",gDisplayBytes diff --git a/src/id/panglosdos.a b/src/id/panglosdos.a new file mode 100644 index 0000000..a0e1279 --- /dev/null +++ b/src/id/panglosdos.a @@ -0,0 +1,165 @@ +;------------------------------- +; PanglosDOS +; in: $0800..$08FF contains boot0 +; $3600..$3FFF contains boot1 +; out: C clear if "Panglossian DOS" was found +; C set if "Panglossian DOS" was not found +; gIsPanglosDOS is set to TRUE or FALSE +; +; module by qkumba +;------------------------------- +!zone { +PanglosDOS + lda jCallRWTS+2 + ldx #$00 ; check for "STY $48;STA $49" + ldy #$04 ; at RWTS entry point + jsr CompareMemory + !byte $84,$48,$85,$49 + bcs .jmpexit + lda #$38 ; check for "SEC;RTS" at $38C3 + ldx #$C3 + ldy #$02 + jsr CompareMemory + !byte $38,$60 + bcs .jmpexit + lda #$38 ; check for "LDA $C08C,X" at $3862 + ldx #$62 + ldy #$03 + jsr CompareMemory + !byte $BD,$8C,$C0 + bcs .jmpexit + lda #$3D ; check for "JSR $3BF9" at $3DB9 + ldx #$B9 + ldy #$03 + jsr CompareMemory + !byte $20,$F9,$3B + bcc + +.jmpexit + jmp .exit + ++ lda #s_gathering + jsr PrintByID + + ;$230 (560) bytes for address keys + ;$230 (560) bytes for data keys + ;=$460 bytes total + + ldy #0 + tya +- sta $900,y + sta $A00,y + ;$B00-B2F is partial + sta $C00,y + sta $D00,y + ;$E00-E2F is partial + iny + bne - + ldy #$2F +- sta $B00,y + sta $E00,y + dey + bpl - + sta $3881 + sta $38EF + lda #$A9 + sta $3880 + sta $38EE + lda #$0F + sta .sector+1 +.readdir lda #$11 + sta gTrack +.sector lda #$D1 + sta gSector + lda #BASEPAGE + sta gAddress+1 + jsr ReadSector + bcs .jmpexit + inc gAddress+1 + lda #$0B ;entry offset +.parsedir + sta .diroff+1 +.diroff ldy #$D1 + lda BASEPAGE<<8,Y + beq .setpanglos + cmp #$FF ;skip deleted files + beq + + sta gTrack + lda (BASEPAGE<<8)+1,Y + sta gSector + jsr ReadSector + bcs .jmpexit + ldx #0 + ldy #0 +.parsets + lda ((BASEPAGE+1)<<8)+$0C,X + beq + + asl + asl + asl + sty modsrc+1 + rol modsrc+1 + asl + rol modsrc+1 + ora ((BASEPAGE+1)<<8)+$0D,X + sta modsrc + lda modsrc+1 + adc #9 ;$900+ + sta modsrc+1 + lda ((BASEPAGE+1)<<8)+$0A + sta (modsrc),Y + lda modsrc+1 + adc #3 + sta modsrc+1 + lda ((BASEPAGE+1)<<8)+$0B + sta (modsrc),Y + inx + inx + bne .parsets ++ lda .diroff+1 + clc + adc #$23 + bne .parsedir + dec .sector+1 + bne .readdir + +.setpanglos + lda #$20 + sta $3DBE + lda #<.callback + sta $3DBF + lda #>.callback + sta $3DC0 + lda #TRUE + sta gIsPanglosDOS + + clc + jmp .exit + +.callback + sty $578 + lda gTrack + asl + asl + asl + ldy #0 + sty modsrc+1 + rol modsrc+1 + asl + rol modsrc+1 + ora gSector + sta modsrc + lda modsrc+1 + adc #9 + sta modsrc+1 + lda (modsrc),Y + sta $38EF ;address sum + lda modsrc+1 + adc #3 + sta modsrc+1 + lda (modsrc),Y + sta $3881 ;data sum + rts + +.exit + rts +} diff --git a/src/id/trace33.a b/src/id/trace33.a index 250b0c6..e77fa67 100755 --- a/src/id/trace33.a +++ b/src/id/trace33.a @@ -77,6 +77,11 @@ _Inspect1a bcs .notprotdos jmp ADStyle .notprotdos + jsr PanglosDOS ; check for a specific bootloader + ; that uses per-file sector encoding + bcs .notpanglosdos + jmp ADStyle +.notpanglosdos lda jCallRWTS+2 ldx #$00 ; check for "STY $48;STA $49" ldy #$04 ; at RWTS entry point diff --git a/src/mods/t00only.a b/src/mods/t00only.a index a94606e..656476a 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/panglosdos.a" ;add only above this line rts diff --git a/src/passport.a b/src/passport.a index ca5f41e..76f7f3c 100755 --- a/src/passport.a +++ b/src/passport.a @@ -148,6 +148,7 @@ FirstMover !source "id/volumename.a" !source "id/dinkeydos.a" !source "id/advent.a" + !source "id/panglosdos.a" !source "print.a" !source "compare.a" !source "modify.a" diff --git a/src/patchers/panglosdos.a b/src/patchers/panglosdos.a new file mode 100644 index 0000000..274aeb3 --- /dev/null +++ b/src/patchers/panglosdos.a @@ -0,0 +1,37 @@ +;------------------------------- +; #PanglosDOS +; RWTS with per-file encryption keys +; +; module by qkumba +;------------------------------- +!zone { + lda gIsPanglosDOS ; only if PanglossianDOS + bne .exit + ldy #6 + jsr SearchTrack + !byte $C9,$AD ;CMP #$AD + !byte $D0,$E7 ;BNE *-$17 + !byte $A5,$46 ;LDA $46 + bcs .exit + inx + inx + inx + inx + ldy #$02 + jsr modify + !byte $A9,$00 ;LDA #$00 + ldy #6 + jsr SearchTrack + !byte $C9,$96 ;CMP #$96 + !byte $D0,$E7 ;BNE *-$17 + !byte $A5,$46 ;LDA $46 + bcs .exit + inx + inx + inx + inx + ldy #$02 + jsr modify + !byte $A9,$00 ;LDA #$00 +.exit +} diff --git a/src/strings/en.a b/src/strings/en.a index b8e17f6..fa7c0e7 100755 --- a/src/strings/en.a +++ b/src/strings/en.a @@ -117,6 +117,7 @@ StringTable !word .tamper !word .microfun !word .advent + !word .gathering ; ; Text can contain substitution strings, which ; are replaced by current values at runtime. Each @@ -142,7 +143,7 @@ StringTable ; can be set directly before calling PrintByID. ; .header - !text "Passport by 4am 2018-06-02",$00 + !text "Passport by 4am 2018-06-07",$00 .mainmenu !text "________________________________________",$8D,$8D,$8D,$8D,$8D,$8D,$8D !text " " @@ -440,4 +441,6 @@ StringTable !text "T%t,S%0 Found Micro Fun protection check",$00 .advent !text "T%t,S%0 Found Interplay bootloader",$8D,$00 +.gathering + !text "Gathering per-file encryption keys",$8D,00 } diff --git a/src/strings/enid.a b/src/strings/enid.a index 7d987d8..f5c39cd 100644 --- a/src/strings/enid.a +++ b/src/strings/enid.a @@ -104,4 +104,5 @@ s_trillium = $62 s_tamper = $63 s_microfun = $64 s_advent = $65 -STRINGCOUNT = $66 +s_gathering = $66 +STRINGCOUNT = $67