mirror of
https://github.com/a2-4am/passport.git
synced 2024-06-30 10:29:39 +00:00
support some Sierra 13-sector protections
This commit is contained in:
parent
d07c4e3ebb
commit
a243c97f68
|
@ -49,6 +49,11 @@
|
||||||
; compile-time flag, no way to change at runtime
|
; compile-time flag, no way to change at runtime
|
||||||
|
|
||||||
FIRSTFILTER
|
FIRSTFILTER
|
||||||
|
;gIsSierra13
|
||||||
|
!byte FALSE ; 0=true, 1=false
|
||||||
|
; reset before each operation
|
||||||
|
; set in sierra13 patcher after patching
|
||||||
|
; used to avoid an expensive search
|
||||||
;gIsDatasoft
|
;gIsDatasoft
|
||||||
!byte FALSE ; 0=true, 1=false
|
!byte FALSE ; 0=true, 1=false
|
||||||
; reset before each operation
|
; reset before each operation
|
||||||
|
|
|
@ -79,9 +79,10 @@ gIsMilliken1 = gIs8b3-$01 ; byte
|
||||||
gAdventureInternational = gIsMilliken1-$01 ; byte
|
gAdventureInternational = gIsMilliken1-$01 ; byte
|
||||||
gIsLaureate = gAdventureInternational-$01 ; byte
|
gIsLaureate = gAdventureInternational-$01 ; byte
|
||||||
gIsDatasoft = gIsLaureate-$01 ; byte
|
gIsDatasoft = gIsLaureate-$01 ; byte
|
||||||
|
gIsSierra13 = gIsDatasoft-$01 ; byte
|
||||||
;LASTFILTER ; add new gIs* above this line
|
;LASTFILTER ; add new gIs* above this line
|
||||||
|
|
||||||
gOnAClearDayYouCanReadForever = gIsDatasoft-$01 ; byte
|
gOnAClearDayYouCanReadForever = gIsSierra13-$01 ; byte
|
||||||
gUsingRAMDisk = gOnAClearDayYouCanReadForever-$01 ; byte
|
gUsingRAMDisk = gOnAClearDayYouCanReadForever-$01 ; byte
|
||||||
gRAMDiskRef = gUsingRAMDisk-$01 ; byte
|
gRAMDiskRef = gUsingRAMDisk-$01 ; byte
|
||||||
gDisplayBytes = gRAMDiskRef-$0A ; 10 bytes
|
gDisplayBytes = gRAMDiskRef-$0A ; 10 bytes
|
||||||
|
@ -139,6 +140,7 @@ ConstructStandardDelivery = jConstructStandardDelivery
|
||||||
!warn "gAdventureInternational=",gAdventureInternational
|
!warn "gAdventureInternational=",gAdventureInternational
|
||||||
!warn "gIsLaureate=",gIsLaureate
|
!warn "gIsLaureate=",gIsLaureate
|
||||||
!warn "gIsDatasoft=",gIsDatasoft
|
!warn "gIsDatasoft=",gIsDatasoft
|
||||||
|
!warn "gIsSierra13=",gIsSierra13
|
||||||
!warn "gOnAClearDayYouCanReadForever=",gOnAClearDayYouCanReadForever
|
!warn "gOnAClearDayYouCanReadForever=",gOnAClearDayYouCanReadForever
|
||||||
!warn "gUsingRAMDisk=",gUsingRAMDisk
|
!warn "gUsingRAMDisk=",gUsingRAMDisk
|
||||||
!warn "gRAMDiskRef=",gRAMDiskRef
|
!warn "gRAMDiskRef=",gRAMDiskRef
|
||||||
|
|
|
@ -352,53 +352,51 @@ checksector
|
||||||
jsr SwitchToUniv
|
jsr SwitchToUniv
|
||||||
+ jsr ReadSector
|
+ jsr ReadSector
|
||||||
bcc nextsector
|
bcc nextsector
|
||||||
pla
|
|
||||||
pha
|
|
||||||
;
|
;
|
||||||
; Uh oh, we got a read error. But do we care?
|
; Uh oh, we got a read error. But do we care?
|
||||||
; Maybe we marked this sector as optional based
|
|
||||||
; on markers in the bootloader.
|
|
||||||
;
|
|
||||||
cmp #kSectorOptional
|
|
||||||
beq .optional
|
|
||||||
;
|
|
||||||
; (13-sector only)
|
|
||||||
; If we just got to this track, check for whole-track protections.
|
; If we just got to this track, check for whole-track protections.
|
||||||
;
|
;
|
||||||
|
ldx #$0F ;16-sector
|
||||||
lda gIsDOS32
|
lda gIsDOS32
|
||||||
bne +
|
bne +
|
||||||
lda gSector
|
ldx #$0C ;13-sector
|
||||||
cmp #$0C
|
+ cpx gSector
|
||||||
beq .tryskip
|
bne .checkoptional
|
||||||
;
|
stx .sub+1
|
||||||
; If we're in the middle of a track, try switching to the
|
|
||||||
; universal RWTS and see if that helps. (Many disks contain
|
|
||||||
; an RWTS that can't read the early tracks or sectors that
|
|
||||||
; contain the RWTS code, since those are loaded by the
|
|
||||||
; disk controller firmware.)
|
|
||||||
;
|
|
||||||
+ lda gSector
|
|
||||||
cmp #$0F
|
|
||||||
bne .tryuniversal
|
|
||||||
;
|
|
||||||
; We just got to this track, so check for a variety
|
|
||||||
; of whole-track conditions that might indicate we should
|
|
||||||
; just skip the entire track
|
|
||||||
.tryskip
|
|
||||||
sta .sub+1
|
|
||||||
jsr SkipTrack
|
jsr SkipTrack
|
||||||
bcs .tryuniversal
|
bcs .checkoptional
|
||||||
; Skip this track (we already printed the reason)
|
; Skip this track (we already printed the reason)
|
||||||
lda #$00
|
lda #$00
|
||||||
jsr ChangeSector
|
jsr ChangeSector
|
||||||
lda checksector+1
|
lda checksector+1
|
||||||
sec
|
sec
|
||||||
.sub sbc #$0F
|
.sub sbc #$0F ;self-modified according to sectors per track
|
||||||
sta checksector+1
|
sta checksector+1
|
||||||
bcs +
|
bcs +
|
||||||
dec checksector+2
|
dec checksector+2
|
||||||
+ jmp nextsector
|
+ jmp nextsector
|
||||||
|
|
||||||
|
; do this only *after* checking for track-skip
|
||||||
|
; to avoid fatal errors on unformatted tracks
|
||||||
|
|
||||||
|
.checkoptional
|
||||||
|
pla
|
||||||
|
pha
|
||||||
|
;
|
||||||
|
; Maybe we marked this sector as optional based
|
||||||
|
; on markers in the bootloader.
|
||||||
|
;
|
||||||
|
cmp #kSectorOptional
|
||||||
|
beq .optional
|
||||||
|
|
||||||
|
;
|
||||||
|
; Otherwise we're in the middle of a track, so try switching to
|
||||||
|
; the universal RWTS and see if that helps. (Many disks contain
|
||||||
|
; an RWTS that can't read the early tracks or sectors that
|
||||||
|
; contain the RWTS code, since those are loaded by the
|
||||||
|
; disk controller firmware.)
|
||||||
|
;
|
||||||
|
|
||||||
.tryuniversal
|
.tryuniversal
|
||||||
lda gIsDOS32 ; is this a DOS 3.2 disk?
|
lda gIsDOS32 ; is this a DOS 3.2 disk?
|
||||||
beq .fatal ; yes, so read error is fatal
|
beq .fatal ; yes, so read error is fatal
|
||||||
|
@ -699,6 +697,7 @@ _applyToAll
|
||||||
!source "patchers/jmpb4bb.a" ; T02 only
|
!source "patchers/jmpb4bb.a" ; T02 only
|
||||||
!source "patchers/dos32muse.a" ; T01 && gIsDOS32 only
|
!source "patchers/dos32muse.a" ; T01 && gIsDOS32 only
|
||||||
!source "patchers/sra.a" ; gIsDOS32 or gIsRWTS only
|
!source "patchers/sra.a" ; gIsDOS32 or gIsRWTS only
|
||||||
|
!source "patchers/sierra13.a" ; gIsDOS32 only
|
||||||
|
|
||||||
lda gPatchCount
|
lda gPatchCount
|
||||||
beq .nopatches
|
beq .nopatches
|
||||||
|
|
101
src/patchers/sierra13.a
Normal file
101
src/patchers/sierra13.a
Normal file
|
@ -0,0 +1,101 @@
|
||||||
|
;-------------------------------
|
||||||
|
; #SIERRA13
|
||||||
|
; search and disable a self-decrypting
|
||||||
|
; protection check used on some Sierra
|
||||||
|
; disks
|
||||||
|
;
|
||||||
|
; Cranston Manor
|
||||||
|
; Jawbreaker ][
|
||||||
|
; Missile Defense
|
||||||
|
; Pegasus ][
|
||||||
|
; Threshold
|
||||||
|
;
|
||||||
|
; module by qkumba
|
||||||
|
;-------------------------------
|
||||||
|
!zone {
|
||||||
|
lda gIsDOS32
|
||||||
|
bne .jmpexit
|
||||||
|
|
||||||
|
;Cranston Manor/Wizard and the Princess
|
||||||
|
;secondary protection
|
||||||
|
|
||||||
|
ldy #10
|
||||||
|
jsr SearchTrack
|
||||||
|
!byte $A9,$24 ;LDA #$24
|
||||||
|
!byte $8D,$1E,$B9 ;STA $B91E
|
||||||
|
!byte $A9,$00 ;LDA #$00
|
||||||
|
!byte $8D,$7F,$89 ;STA $897F
|
||||||
|
bcs +
|
||||||
|
inx
|
||||||
|
inx ;patch the STA
|
||||||
|
ldy #$01
|
||||||
|
jsr modify
|
||||||
|
!byte $AD ;LDA
|
||||||
|
jmp .exit
|
||||||
|
|
||||||
|
;Missile Defense
|
||||||
|
|
||||||
|
+ ldy #17
|
||||||
|
jsr SearchTrack
|
||||||
|
!byte $20,$00,$8F ;JSR $8F00
|
||||||
|
!byte $20,$00,$90 ;JSR $9000
|
||||||
|
!byte $20,$00,$8F ;JSR $8F00
|
||||||
|
!byte $A9,$00 ;LDA #$00
|
||||||
|
!byte $85,$03 ;STA $03
|
||||||
|
!byte $A9,$20 ;LDA #$20
|
||||||
|
!byte $85,$02 ;STA $02
|
||||||
|
bcs +
|
||||||
|
pha
|
||||||
|
lda #s_sierra
|
||||||
|
jsr PrintByID
|
||||||
|
pla
|
||||||
|
inx
|
||||||
|
inx
|
||||||
|
inx ;patch the second JSR
|
||||||
|
ldy #$01
|
||||||
|
jsr modify
|
||||||
|
!byte $2C ;LDA
|
||||||
|
jmp .exit
|
||||||
|
|
||||||
|
;Cranston Manor, etc.
|
||||||
|
|
||||||
|
+ ldy #14
|
||||||
|
jsr SearchTrack
|
||||||
|
!byte $A0,$00 ;LDY #$00
|
||||||
|
!byte $A9,$55 ;LDA #$55
|
||||||
|
!byte $59,WILDCARD,WILDCARD ;EOR $xxxx,Y
|
||||||
|
!byte $99,WILDCARD,WILDCARD ;STA $xxxx,Y
|
||||||
|
!byte $88 ;DEY
|
||||||
|
!byte $D0,$F5 ;BNE *-9
|
||||||
|
!byte $EA ;NOP
|
||||||
|
bcs .exit
|
||||||
|
|
||||||
|
cpx #$50
|
||||||
|
bcc +
|
||||||
|
tay
|
||||||
|
dey ;Pegasus code spans pages
|
||||||
|
tya
|
||||||
|
clc
|
||||||
|
+ sta .adjust+1
|
||||||
|
adc #BASEPAGE
|
||||||
|
pha
|
||||||
|
lda #s_sierra
|
||||||
|
jsr PrintByID
|
||||||
|
pla
|
||||||
|
ldy #8
|
||||||
|
jsr SearchSector
|
||||||
|
!byte $85,WILDCARD ;encoded BNE *+xx
|
||||||
|
!byte $DD ;encoded DEY
|
||||||
|
!byte WILDCARD,$A0 ;encoded Bxx *-9
|
||||||
|
!byte $E8,$DD,$95 ;encoded LDA $C088,X
|
||||||
|
bcs .exit
|
||||||
|
inx
|
||||||
|
.adjust lda #$d1
|
||||||
|
ldy #$01
|
||||||
|
jsr modify
|
||||||
|
!byte $55 ;encoded zero
|
||||||
|
lda #TRUE
|
||||||
|
sta gIsSierra13
|
||||||
|
|
||||||
|
.exit
|
||||||
|
}
|
|
@ -134,7 +134,7 @@ StringTable
|
||||||
; can be set directly before calling PrintByID.
|
; can be set directly before calling PrintByID.
|
||||||
;
|
;
|
||||||
.header
|
.header
|
||||||
!text "Passport by 4am 2017-11-25",$00
|
!text "Passport by 4am 2017-12-02",$00
|
||||||
.mainmenu
|
.mainmenu
|
||||||
!text "________________________________________",$8D,$8D,$8D,$8D,$8D,$8D,$8D
|
!text "________________________________________",$8D,$8D,$8D,$8D,$8D,$8D,$8D
|
||||||
!text " "
|
!text " "
|
||||||
|
|
Loading…
Reference in New Issue
Block a user