mirror of
https://github.com/a2-4am/passport.git
synced 2024-12-22 19:30:50 +00:00
refactor inspect0
This commit is contained in:
parent
ff2af65bb8
commit
3ad2c545c6
@ -7,9 +7,9 @@
|
|||||||
;-------------------------------
|
;-------------------------------
|
||||||
!zone {
|
!zone {
|
||||||
IDBootloader
|
IDBootloader
|
||||||
|
;
|
||||||
; reset all per-disk globals
|
; reset all per-disk globals
|
||||||
|
;
|
||||||
lda #FALSE
|
lda #FALSE
|
||||||
sta gIsBoot0
|
sta gIsBoot0
|
||||||
sta gIsBoot1
|
sta gIsBoot1
|
||||||
@ -17,25 +17,24 @@ IDBootloader
|
|||||||
sta gIsRWTS
|
sta gIsRWTS
|
||||||
sta gIsProDOS
|
sta gIsProDOS
|
||||||
sta gIsPascal
|
sta gIsPascal
|
||||||
sta gIsDatasoft
|
|
||||||
sta gIsProtDOS
|
sta gIsProtDOS
|
||||||
sta gIsEA
|
sta gIsEA
|
||||||
sta gIsEEEF
|
sta gIsEEEF
|
||||||
lda #$00
|
lda #$00
|
||||||
sta gLastTrack
|
sta gLastTrack
|
||||||
|
;
|
||||||
; Quick sanity check -- only recognized values for $0800
|
; Quick sanity check -- only recognized values for $0800
|
||||||
; are 1 or 2 for regular disks, and 5 for possible Electronic Arts.
|
; are 1 or 2 for regular disks, and 5 for possible Electronic Arts.
|
||||||
|
;
|
||||||
lda $0800
|
lda $0800
|
||||||
beq +
|
beq +
|
||||||
cmp #$03
|
cmp #$03
|
||||||
bcc ++
|
bcc .sane
|
||||||
cmp #$05
|
cmp #$05
|
||||||
beq ++
|
beq .sane
|
||||||
+ jmp UseUniversal
|
+ jmp UseUniversal
|
||||||
|
|
||||||
++
|
.sane
|
||||||
;
|
;
|
||||||
; Copy the boot sector from $0800 to the track/sector buffer
|
; Copy the boot sector from $0800 to the track/sector buffer
|
||||||
; so we can reuse our standard compare functions.
|
; so we can reuse our standard compare functions.
|
||||||
@ -44,80 +43,32 @@ IDBootloader
|
|||||||
ldx #BASEPAGE
|
ldx #BASEPAGE
|
||||||
ldy #$01
|
ldy #$01
|
||||||
jsr CopyMemory
|
jsr CopyMemory
|
||||||
|
|
||||||
lda #$00
|
|
||||||
ldx #$00
|
|
||||||
ldy #$05
|
|
||||||
jsr compare ; if T00,S00,$00 ==
|
|
||||||
|
|
||||||
; This abbreviated signature matches all ProDOS disks
|
|
||||||
; I can find, with no false positives.
|
|
||||||
; Some disks jump to $08FF at $0804 (SOS entry point).
|
|
||||||
; Others have a modified T00,S00 but eventually load
|
|
||||||
; ProDOS (e.g. 1-2-3 Sequence Me, Alge-Blaster Plus,
|
|
||||||
; Dazzle Draw, SuperPrint II)
|
|
||||||
|
|
||||||
!byte 01,$38,$B0,$03,$4C
|
|
||||||
ldx #TRUE
|
|
||||||
bcc .prodos
|
|
||||||
ldx #FALSE
|
|
||||||
.prodos
|
|
||||||
stx gIsProDOS
|
|
||||||
|
|
||||||
lda #$00
|
|
||||||
ldx #$00
|
|
||||||
ldy #$08
|
|
||||||
jsr compare ; if T00,S00,$00 ==
|
|
||||||
|
|
||||||
; Apple Pascal signature (version < 1.3)
|
|
||||||
; The wildcard in 7th position catches alternate jump
|
|
||||||
; addresses (e.g. Wizardry I, Sundog Frozen Legacy)
|
|
||||||
|
|
||||||
!byte $01,$E0,$60,$F0,$03,$4C,WILDCARD,$08
|
|
||||||
ldx #TRUE
|
|
||||||
bcc .pascal
|
|
||||||
lda #$00
|
|
||||||
ldx #$00
|
|
||||||
ldy #$08
|
|
||||||
jsr compare ; or if T00,S00,$00 ==
|
|
||||||
|
|
||||||
; Pascal 1.3 signature [thanks Marco V.]
|
|
||||||
|
|
||||||
!byte $01,$E0,$70,$B0,$04,$E0,$40,$B0
|
|
||||||
ldx #TRUE
|
|
||||||
bcc .pascal
|
|
||||||
ldx #FALSE
|
|
||||||
.pascal
|
|
||||||
stx gIsPascal
|
|
||||||
|
|
||||||
;
|
;
|
||||||
; Try to identify DOS 3.3-shaped bootloader, which
|
; Try to identify DOS 3.3-shaped bootloader.
|
||||||
; we can maybe trace to capture the RWTS in memory.
|
; Exit via custom trace function if found.
|
||||||
;
|
;
|
||||||
jsr IDDOS33
|
jsr IDDOS33
|
||||||
bcs .notdos33
|
bcs +
|
||||||
lda #TRUE
|
lda #TRUE
|
||||||
sta gIsBoot0
|
sta gIsBoot0
|
||||||
lda #s_dosb0
|
lda #s_dosb0
|
||||||
jsr PrintByID
|
jsr PrintByID
|
||||||
jmp TraceDOS33
|
jmp TraceDOS33
|
||||||
|
|
||||||
.notdos33
|
|
||||||
;
|
;
|
||||||
; Try to identify a variant bootloader that calls to $08B3
|
; Try to identify a variant bootloader that calls to $08B3
|
||||||
; early to munge the nibble tables used by the drive firmware.
|
; early to munge the nibble tables used by the drive firmware.
|
||||||
|
; Exit via custom trace function if found.
|
||||||
;
|
;
|
||||||
jsr ID8b3
|
+ jsr ID8b3
|
||||||
bcs .not8b3
|
bcs +
|
||||||
lda #s_jsr8b3
|
lda #s_jsr8b3
|
||||||
jsr PrintByID
|
jsr PrintByID
|
||||||
jmp Trace8B3
|
jmp Trace8B3
|
||||||
|
|
||||||
.not8b3
|
|
||||||
;
|
;
|
||||||
; Try to identify all the different MECC fastloader variants.
|
; Try to identify all the different MECC fastloader variants.
|
||||||
|
; Exit via custom trace function if found.
|
||||||
;
|
;
|
||||||
jsr IDMECC
|
+ jsr IDMECC
|
||||||
bcs .notmecc
|
bcs .notmecc
|
||||||
lda #s_mecc
|
lda #s_mecc
|
||||||
jsr PrintByID
|
jsr PrintByID
|
||||||
@ -125,73 +76,44 @@ IDBootloader
|
|||||||
jsr PrereadT00
|
jsr PrereadT00
|
||||||
bcs .notmecc
|
bcs .notmecc
|
||||||
jsr IDMECC1
|
jsr IDMECC1
|
||||||
bcs .notmecc1
|
bcs +
|
||||||
jmp foundmecc1
|
jmp foundmecc1
|
||||||
.notmecc1
|
+ jsr IDMECC2
|
||||||
jsr IDMECC2
|
bcs +
|
||||||
bcs .notmecc2
|
|
||||||
jmp foundmecc2
|
jmp foundmecc2
|
||||||
|
+ jsr IDMECC3
|
||||||
.notmecc2
|
bcs +
|
||||||
jsr IDMECC3
|
|
||||||
bcs .notmecc3
|
|
||||||
jmp foundmecc3
|
jmp foundmecc3
|
||||||
.notmecc3
|
+ jsr IDMECC4
|
||||||
jsr IDMECC4
|
bcs .notmecc
|
||||||
bcs .notmecc4
|
|
||||||
jmp foundmecc4
|
jmp foundmecc4
|
||||||
.notmecc4
|
|
||||||
.notmecc
|
.notmecc
|
||||||
;
|
;
|
||||||
; Try to identify the encrypted Datasoft bootloader.
|
; Try to identify DOS 3.3P (Special Delivery) bootloader.
|
||||||
|
; Exit via custom trace function if found.
|
||||||
;
|
;
|
||||||
jsr IDDatasoft
|
|
||||||
bcs .notdatasoft
|
|
||||||
lda #s_datasoftb0
|
|
||||||
jsr PrintByID
|
|
||||||
lda #TRUE
|
|
||||||
sta gIsDatasoft
|
|
||||||
jmp .useuniv
|
|
||||||
|
|
||||||
.notdatasoft
|
|
||||||
;
|
|
||||||
; Try to identify ProDOS bootloader.
|
|
||||||
;
|
|
||||||
lda gIsProDOS
|
|
||||||
bne .notprodos
|
|
||||||
lda #s_prodosb0
|
|
||||||
jsr PrintByID
|
|
||||||
jmp .useuniv
|
|
||||||
|
|
||||||
.notprodos
|
|
||||||
;
|
|
||||||
; Try to identify Apple Pascal bootloader (all variants).
|
|
||||||
;
|
|
||||||
lda gIsPascal
|
|
||||||
bne .notpascal
|
|
||||||
lda #s_pascalb0
|
|
||||||
jsr PrintByID
|
|
||||||
|
|
||||||
.notpascal
|
|
||||||
jsr IDSpecDel
|
jsr IDSpecDel
|
||||||
bcs .notspecdel
|
bcs +
|
||||||
lda #s_specdel
|
lda #s_specdel
|
||||||
jsr PrintByID
|
jsr PrintByID
|
||||||
jmp TraceSpecDel
|
jmp TraceSpecDel
|
||||||
|
;
|
||||||
.notspecdel
|
; Try to identify Electronic Arts bootloader.
|
||||||
|
; Exit via custom trace function if found.
|
||||||
|
;
|
||||||
|
+ jsr IDEA
|
||||||
|
bcs +
|
||||||
|
jmp foundea
|
||||||
;
|
;
|
||||||
; Try to detect whether there is code in the boot sector
|
; Try to detect whether there is code in the boot sector
|
||||||
; that loads 4-and-4-encoded data. This is an early escape
|
; that loads 4-and-4-encoded data. This is an early escape
|
||||||
; hatch for disks that are guaranteed to fail later anyway.
|
; hatch for disks that are guaranteed to fail later anyway.
|
||||||
;
|
;
|
||||||
jsr IDEncoded44
|
+ jsr IDEncoded44
|
||||||
bcs .notencoded44
|
bcs +
|
||||||
lda #s_encoded44
|
lda #s_encoded44
|
||||||
jsr PrintByID
|
jsr PrintByID
|
||||||
jmp TheEnd
|
jmp TheEnd
|
||||||
|
|
||||||
.notencoded44
|
|
||||||
;
|
;
|
||||||
; Try to detect whether there is code in the boot sector
|
; Try to detect whether there is code in the boot sector
|
||||||
; that loads 5-and-3-encoded data (like DOS 3.2 disks with
|
; that loads 5-and-3-encoded data (like DOS 3.2 disks with
|
||||||
@ -200,37 +122,49 @@ IDBootloader
|
|||||||
; this serves as an early escape hatch for disks that are
|
; this serves as an early escape hatch for disks that are
|
||||||
; guaranteed to fail later anyway.
|
; guaranteed to fail later anyway.
|
||||||
;
|
;
|
||||||
jsr IDEncoded53
|
+ jsr IDEncoded53
|
||||||
bcs .notencoded53
|
bcs +
|
||||||
lda #s_encoded53
|
lda #s_encoded53
|
||||||
jsr PrintByID
|
jsr PrintByID
|
||||||
jmp TheEnd
|
jmp TheEnd
|
||||||
|
|
||||||
.notencoded53
|
|
||||||
;
|
;
|
||||||
; Try to identify Electronic Arts bootloader.
|
; ProDOS (all versions)
|
||||||
;
|
;
|
||||||
.tryea
|
+ jsr IDProDOS
|
||||||
jsr IDEA
|
bcs +
|
||||||
bcs .notea
|
lda #s_prodosb0
|
||||||
jmp foundea
|
jsr PrintByID
|
||||||
|
lda #TRUE
|
||||||
.notea
|
sta gIsProDOS
|
||||||
|
beq .useuniv ; always branches
|
||||||
;
|
;
|
||||||
; Try to identify David-DOS bootloader
|
;Apple Pascal (all versions)
|
||||||
; (no special behavior for now because all samples I have are
|
|
||||||
; handled by built-in RWTS, so no need to trace)
|
|
||||||
;
|
;
|
||||||
jsr IDDavid
|
+ jsr IDPascal
|
||||||
bcs .notdavid
|
bcs +
|
||||||
|
lda #s_pascalb0
|
||||||
|
jsr PrintByID
|
||||||
|
lda #TRUE
|
||||||
|
sta gIsPascal
|
||||||
|
beq .useuniv ; always branches
|
||||||
|
;
|
||||||
|
; Encrypted Datasoft bootloader
|
||||||
|
;
|
||||||
|
+ jsr IDDatasoft
|
||||||
|
bcs +
|
||||||
|
lda #s_datasoftb0
|
||||||
|
jsr PrintByID
|
||||||
|
bcc .useuniv ; always branches
|
||||||
|
;
|
||||||
|
; David-DOS II
|
||||||
|
;
|
||||||
|
+ jsr IDDavid
|
||||||
|
bcs +
|
||||||
lda #s_daviddos
|
lda #s_daviddos
|
||||||
jsr PrintByID
|
jsr PrintByID
|
||||||
.notdavid
|
|
||||||
|
+
|
||||||
.useuniv
|
.useuniv
|
||||||
;
|
|
||||||
; We didn't recognize the boot sector, so use the universal
|
|
||||||
; (built-in) RWTS and hope for the best
|
|
||||||
;
|
|
||||||
jmp UseUniversal
|
jmp UseUniversal
|
||||||
}
|
}
|
||||||
|
|
||||||
|
39
src/id/pascal.a
Normal file
39
src/id/pascal.a
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
;-------------------------------
|
||||||
|
; IDPascal
|
||||||
|
; identify Apple Pascal bootloader
|
||||||
|
;
|
||||||
|
; in: $0800..$08FF contains T00,S00
|
||||||
|
; first page of track buffer also contains T00,S00
|
||||||
|
; out: C clear if Apple Pascal bootloader found
|
||||||
|
; C set otherwise
|
||||||
|
; all registers clobbered
|
||||||
|
; all other flags clobbered
|
||||||
|
;-------------------------------
|
||||||
|
!zone {
|
||||||
|
IDPascal
|
||||||
|
;
|
||||||
|
; Apple Pascal signature (version < 1.3)
|
||||||
|
; The wildcard in 7th position catches alternate jump
|
||||||
|
; addresses (e.g. Wizardry I, Sundog Frozen Legacy)
|
||||||
|
;
|
||||||
|
lda #$00
|
||||||
|
ldx #$00
|
||||||
|
ldy #$08
|
||||||
|
jsr compare ; if T00,S00,$00 ==
|
||||||
|
!byte $01
|
||||||
|
!byte $E0,$60
|
||||||
|
!byte $F0,$03
|
||||||
|
!byte $4C,WILDCARD,$08
|
||||||
|
bcc .exit
|
||||||
|
;
|
||||||
|
; Apple Pascal 1.3 signature [thanks Marco V.]
|
||||||
|
;
|
||||||
|
ldy #$08
|
||||||
|
jsr compare ; or if T00,S00,$00 ==
|
||||||
|
!byte $01
|
||||||
|
!byte $E0,$70
|
||||||
|
!byte $B0,$04
|
||||||
|
!byte $E0,$40
|
||||||
|
!byte $B0
|
||||||
|
.exit rts
|
||||||
|
}
|
28
src/id/prodos.a
Normal file
28
src/id/prodos.a
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
;-------------------------------
|
||||||
|
; IDProDOS
|
||||||
|
; identify ProDOS bootloader
|
||||||
|
;
|
||||||
|
; in: $0800..$08FF contains T00,S00
|
||||||
|
; first page of track buffer also contains T00,S00
|
||||||
|
; out: C clear if Apple Pascal bootloader found
|
||||||
|
; C set otherwise
|
||||||
|
; all registers clobbered
|
||||||
|
; all other flags clobbered
|
||||||
|
;-------------------------------
|
||||||
|
!zone {
|
||||||
|
IDProDOS
|
||||||
|
; Some disks jump to $08FF at $0804 (SOS entry point).
|
||||||
|
; Others have a modified T00,S00 but eventually load
|
||||||
|
; ProDOS (e.g. 1-2-3 Sequence Me, Alge-Blaster Plus,
|
||||||
|
; Dazzle Draw, SuperPrint II). All of these variants
|
||||||
|
; will match.
|
||||||
|
lda #$00
|
||||||
|
ldx #$00
|
||||||
|
ldy #$05
|
||||||
|
jsr compare ; if T00,S00,$00 ==
|
||||||
|
!byte $01
|
||||||
|
!byte $38 ; SEC
|
||||||
|
!byte $B0,$03 ; BCS +3
|
||||||
|
!byte $4C ; JMP
|
||||||
|
rts
|
||||||
|
}
|
@ -139,8 +139,10 @@ FirstMover
|
|||||||
|
|
||||||
!source "analyze.a"
|
!source "analyze.a"
|
||||||
!source "id/inspect0.a"
|
!source "id/inspect0.a"
|
||||||
!source "id/trace.a"
|
|
||||||
!source "id/dos33.a"
|
!source "id/dos33.a"
|
||||||
|
!source "id/trace.a"
|
||||||
|
!source "id/prodos.a"
|
||||||
|
!source "id/pascal.a"
|
||||||
!source "id/jsr8b3.a"
|
!source "id/jsr8b3.a"
|
||||||
!source "id/trace8b3.a"
|
!source "id/trace8b3.a"
|
||||||
!source "id/mecc.a"
|
!source "id/mecc.a"
|
||||||
@ -782,10 +784,6 @@ gIsPascal
|
|||||||
!byte FALSE ; 0=true, 1=false
|
!byte FALSE ; 0=true, 1=false
|
||||||
; reset before each operation
|
; reset before each operation
|
||||||
; set in IDBootloader() after reading T00,S00
|
; set in IDBootloader() after reading T00,S00
|
||||||
gIsDatasoft
|
|
||||||
!byte FALSE ; 0=true, 1=false
|
|
||||||
; reset before each operation
|
|
||||||
; set in IDBootloader() after reading T00,S00
|
|
||||||
gIsProtDOS
|
gIsProtDOS
|
||||||
!byte FALSE ; 0=true, 1=false
|
!byte FALSE ; 0=true, 1=false
|
||||||
; reset before each operation
|
; reset before each operation
|
||||||
|
@ -4,9 +4,8 @@
|
|||||||
; e.g. Video Title Shop, Tomahawk //e
|
; e.g. Video Title Shop, Tomahawk //e
|
||||||
;-------------------------------
|
;-------------------------------
|
||||||
!zone {
|
!zone {
|
||||||
_datasoft
|
jsr IDDatasoft
|
||||||
lda gIsDatasoft ; only ever seen this protection
|
bcs .exit
|
||||||
bne .exit ; on Datasoft disks (ID'd earlier)
|
|
||||||
|
|
||||||
ldy #$06
|
ldy #$06
|
||||||
jsr SearchTrack
|
jsr SearchTrack
|
||||||
|
Loading…
Reference in New Issue
Block a user