shave some bytes

This commit is contained in:
4am 2021-06-19 10:54:56 -04:00
parent 9ecb49331b
commit 7a75188e4f
11 changed files with 115 additions and 128 deletions

View File

@ -15,7 +15,7 @@
; - Mindshadow ; - Mindshadow
; - The Tracer Sanction ; - The Tracer Sanction
;------------------------------- ;-------------------------------
IDAdvent !macro IDAdvent {
lda #BASEPAGE lda #BASEPAGE
ldy #33 ldy #33
jsr SearchSector jsr SearchSector
@ -33,7 +33,8 @@ IDAdvent
!byte $D0,$F5 ;BNE $-8 !byte $D0,$F5 ;BNE $-8
!byte $A6,$2B ;LDX $2B !byte $A6,$2B ;LDX $2B
!byte $4C,$00 ;JMP $xx00 !byte $4C,$00 ;JMP $xx00
rts ; passport-test-suite/Borrowed Time.woz [C=0] matches ; passport-test-suite/Borrowed Time.woz [C=0] matches
}
foundadvent foundadvent
; ;

View File

@ -10,34 +10,19 @@
; ;
; module by qkumba ; module by qkumba
;------------------------------- ;-------------------------------
IDEA !macro IDEA {
lda #$00
tax
ldy #36
jsr compare
!byte $05,$4C,$04,$08,$A9,$00,$8D,$F2
!byte $03,$A9,$C6,$8D,$F3,$03,$49,$A5
!byte $8D,$F4,$03,$A9,$00,$8D,$C7,$09
!byte $AD,$E9,$C0,$A9,$B0,$85,$3E,$A9
!byte $02,$20,$00,$0C
bcc +
lda #$00
tax
ldy #39
jsr compare
!byte $05,$4C,$04,$08,$A9,$00,$8D,$F2
!byte $03,$A9,$C6,$8D,$F3,$03,$49,$A5
!byte $8D,$F4,$03,$A9,$00,$8D,$C7,$09
!byte $AD,$E9,$C0,$A9,$B7,$48,$A9,$B0
!byte $85,$3E,$A9,$00,$20,$00,$0C
bcc +
lda #$00 lda #$00
tax tax
ldy #16 ldy #16
jsr compare jsr compare
!byte $05,$4C,$04,$08,$A9,$00,$8D,$F2
!byte $03,$A9,$C6,$8D,$F3,$03,$49,$A5
bcc +
jsr compare
!byte $01,$A5,$27,$C9,$09,$D0,$2E,$A2 !byte $01,$A5,$27,$C9,$09,$D0,$2E,$A2
!byte $10,$8A,$9D,$EF,$03,$CA,$D0,$F9 !byte $10,$8A,$9D,$EF,$03,$CA,$D0,$F9
+ rts +
}
foundea foundea
; ;

View File

@ -10,13 +10,12 @@
; all registers clobbered ; all registers clobbered
; all other flags clobbered ; all other flags clobbered
;------------------------------- ;-------------------------------
!zone { !macro IDEncoded44 {
IDEncoded44
ldy #$07 ldy #$07
jsr SearchTrack jsr SearchTrack
!byte $BD,$8C,$C0 !byte $BD,$8C,$C0
!byte $10,$FB !byte $10,$FB
!byte $38 !byte $38
!byte $2A !byte $2A
rts ; passport-test-suite/Sneakers.woz [C=0] matches ; passport-test-suite/Sneakers.woz [C=0] matches
} }

View File

@ -11,11 +11,9 @@
; all registers clobbered ; all registers clobbered
; all other flags clobbered ; all other flags clobbered
;------------------------------- ;-------------------------------
!zone { !macro IDEncoded53 {
IDEncoded53
ldy #$10 ldy #$10
jsr SearchTrack jsr SearchTrack
!byte $BD,$8C,$C0,$10,$FB,$C9,$B5,$F0 !byte $BD,$8C,$C0,$10,$FB,$C9,$B5,$F0
!byte $09,$28,$90,$DF,$49,$AD,$F0,$1F !byte $09,$28,$90,$DF,$49,$AD,$F0,$1F
rts
} }

View File

@ -5,7 +5,6 @@
; ;
; in: T00,S00 in memory at $0800 ; in: T00,S00 in memory at $0800
;------------------------------- ;-------------------------------
!zone {
IDBootloader IDBootloader
; ;
; Reset all per-disk globals. ; Reset all per-disk globals.
@ -57,8 +56,10 @@ IDBootloader
.sanity .sanity
; ;
; Quick sanity check -- only recognized values for $0800 ; Quick sanity check -- only recognized values for $0800 are
; are 1 or 2 for regular disks, and 5 for possible Electronic Arts. ; $01 = most disks
; $02 = Special Delivery (DOS 3.3P)
; $05 = some EA disks
; ;
lda $0800 lda $0800
beq + beq +
@ -99,24 +100,25 @@ IDBootloader
jsr PrintByID jsr PrintByID
+ !byte $FD ; SMC + !byte $FD ; SMC
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. ; Exit via custom trace function if found.
; ;
.notdos33
jsr ID8b3 jsr ID8b3
bcs + bcs .not8b3
jsr PrintByID jsr PrintByID
!byte s_jsr8b3 !byte s_jsr8b3
lda #TRUE lda #TRUE
sta gIs8b3 sta gIs8b3
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. ; Exit via custom trace function if found.
; ;
+ jsr IDMECC jsr IDMECC
bcs .notmecc bcs .notmecc
lda #ID_MECC_UNK lda #ID_MECC_UNK
sta gMECCFastloadType sta gMECCFastloadType
@ -149,64 +151,71 @@ IDBootloader
; Try to identify DOS 3.3P (Special Delivery) bootloader. ; Try to identify DOS 3.3P (Special Delivery) bootloader.
; Exit via custom trace function if found. ; Exit via custom trace function if found.
; ;
jsr IDSpecDel +IDSpecDel
bcs + bcs .notSpecialDelivery
jsr PrintByID jsr PrintByID
!byte s_specdel !byte s_specdel
jmp TraceSpecDel jmp TraceSpecDel
.notSpecialDelivery
; ;
; Try to identify Laureate Learning Systems bootloader. ; Try to identify Laureate Learning Systems bootloader.
; Exit via custom trace function if found. ; Exit via custom trace function if found.
; ;
+ jsr IDLaureate +IDLaureate
bcs + bcs .notLaureate
jsr PrintByID jsr PrintByID
!byte s_laureate !byte s_laureate
lda #TRUE lda #TRUE
sta gIsLaureate sta gIsLaureate
lda #$0B lda #$0B
jsr PrereadT00Partial jsr PrereadT00Partial
bcs + bcs .notLaureate
jmp TraceLaureate jmp TraceLaureate
.notLaureate
; ;
; Try to identify Electronic Arts bootloader. ; Try to identify Electronic Arts bootloader.
; Exit via custom trace function if found. ; Exit via custom trace function if found.
; ;
+ jsr IDEA +IDEA
bcs + bcs .notEA
jmp foundea jmp foundea
.notEA
; ;
; Try to identify Interplay bootloader. ; Try to identify Interplay bootloader.
; Exit via custom trace function if found. ; Exit via custom trace function if found.
; ;
+ jsr IDAdvent +IDAdvent
bcs + bcs .notInterplay
jmp foundadvent jmp foundadvent
.notInterplay
; ;
; Try to identify hybrid 16-/13-sector bootloader on ; Try to identify hybrid 16-/13-sector bootloader on
; DOS 3.2 disks. ; DOS 3.2 disks.
; Exit via custom trace function if found. ; Exit via custom trace function if found.
; ;
+ jsr IDDOS32 +IDDOS32
bcs + bcs .notDOS32
jsr PrintByID jsr PrintByID
!byte s_dos32b0 !byte s_dos32b0
jmp TraceDOS32 jmp TraceDOS32
+ jsr IDDOS32LO .notDOS32
bcs + +IDDOS32LO
bcs .notDOS32LO
jsr PrintByID jsr PrintByID
!byte s_dos32b0 !byte s_dos32b0
jmp TraceDOS32LO jmp TraceDOS32LO
.notDOS32LO
; ;
; 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 will fail later anyway. ; hatch for disks that will fail later anyway.
; ;
+ jsr IDEncoded44 +IDEncoded44
bcs + bcs .not44
jsr PrintByID jsr PrintByID
!byte s_encoded44 !byte s_encoded44
jmp TheEnd jmp TheEnd
.not44
; ;
; 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. If the earlier DOS 3.2 ; that loads 5-and-3-encoded data. If the earlier DOS 3.2
@ -215,130 +224,140 @@ IDBootloader
; this serves as an early escape hatch for disks that will ; this serves as an early escape hatch for disks that will
; fail later anyway. ; fail later anyway.
; ;
+ jsr IDEncoded53 +IDEncoded53
bcs + bcs .not53
jsr PrintByID jsr PrintByID
!byte s_encoded53 !byte s_encoded53
jmp TheEnd jmp TheEnd
.not53
; ;
; ProDOS (all versions) ; ProDOS (all versions)
; ;
+ jsr IDProDOS +IDProDOS
bcs + bcs .notProDOS
jsr PrintByID jsr PrintByID
!byte s_prodosb0 !byte s_prodosb0
lda #TRUE lda #TRUE
sta gIsProDOS sta gIsProDOS
jsr IDVolumeName jsr IDVolumeName
; /!\ execution falls through here because Dinkey-DOS disks are also ProDOS
.notProDOS
; ;
; Dinkey-DOS (ProDOS file structure with DOS 3.3-ish RWTS in language card) ; Dinkey-DOS (ProDOS file structure with DOS 3.3-ish RWTS in language card)
; detectable now because IDVolumeName just read the first sector of the ; detectable now because IDVolumeName just read the first sector of the
; volume directory into memory so we can look for a unique filename ; volume directory into memory so we can look for a unique filename
; ;
+
+IDDinkeyDOS +IDDinkeyDOS
bcs + bcs .notDinkey
lda #$0B lda #$0B
sta gDisplayBytes sta gDisplayBytes
jsr PrintByID jsr PrintByID
!byte s_dinkeydos !byte s_dinkeydos
lda #TRUE lda #TRUE
sta gIsDinkeyDOS sta gIsDinkeyDOS
; /!\ execution falls through here to save bytes (no other IDs will match)
.notDinkey
; ;
; Apple Pascal (all versions) ; Apple Pascal (all versions)
; ;
+
+IDPascal +IDPascal
bcs + bcs .notPascal
jsr PrintByID jsr PrintByID
!byte s_pascalb0 !byte s_pascalb0
lda #TRUE lda #TRUE
sta gIsPascal sta gIsPascal
jsr IDVolumeName jsr IDVolumeName
; /!\ execution falls through here to save bytes (no other IDs will match)
.notPascal
; ;
; David-DOS II ; David-DOS II
; ;
+
+IDDavid +IDDavid
bcs + bcs .notDavid
jsr PrintByID jsr PrintByID
!byte s_daviddos !byte s_daviddos
lda #TRUE lda #TRUE
sta gIsDavidDOS sta gIsDavidDOS
; /!\ execution falls through here to save bytes (no other IDs will match)
.notDavid
; ;
; Encrypted Datasoft bootloader ; Encrypted Datasoft bootloader
; ;
+
+IDDatasoft +IDDatasoft
bcs + bcs .notDatasoft
jsr PrintByID jsr PrintByID
!byte s_datasoftb0 !byte s_datasoftb0
lda #TRUE lda #TRUE
sta gIsDatasoft sta gIsDatasoft
; /!\ execution falls through here to save bytes (no other IDs will match)
.notDatasoft
; ;
; TSR bootloader ; TSR bootloader
; ;
+
+IDTSR +IDTSR
bcs + bcs .notTSR
jsr PrintByID jsr PrintByID
!byte s_tsr !byte s_tsr
lda #TRUE lda #TRUE
sta gIsTSR sta gIsTSR
; /!\ execution falls through here to save bytes (no other IDs will match)
.notTSR
; ;
; Micrograms bootloader ; Micrograms bootloader
; (just for display) ; (just for display)
; ;
+
+IDMicrograms +IDMicrograms
bcs + bcs .notMicrograms
jsr PrintByID jsr PrintByID
!byte s_micrograms !byte s_micrograms
; /!\ execution falls through here to save bytes (no other IDs will match)
.notMicrograms
; ;
; Quick-DOS ; Quick-DOS
; (just for display) ; (just for display)
; ;
+
+IDQuickDOS +IDQuickDOS
bcs + bcs .notQuickDOS
jsr PrintByID jsr PrintByID
!byte s_quickdos !byte s_quickdos
; /!\ execution falls through here to save bytes (no other IDs will match)
.notQuickDOS
; ;
; RDOS ; RDOS (16-sector)
; (just for display) ; (just for display)
; ;
+ +
+IDRDOS +IDRDOS16
bcs + bcs .notRDOS16
jsr PrintByID jsr PrintByID
!byte s_rdos !byte s_rdos
; /!\ execution falls through here to save bytes (no other IDs will match)
.notRDOS16
; ;
; Dav Holle encrypted bootloader ; Dav Holle encrypted bootloader
; (will be decrypted and patched) ; (will be decrypted and patched)
; ;
+ jsr IDHolle jsr IDHolle
bcs + bcs .notHolle
jsr PrintByID jsr PrintByID
!byte s_holle !byte s_holle
lda #TRUE lda #TRUE
sta gIsHolle sta gIsHolle
; /!\ execution falls through here to save bytes (no other IDs will match)
.notHolle
; ;
; 555 bootloader ; 555 bootloader
; ;
+ jsr ID555 jsr ID555
bcs + bcs .not555
lda #0 lda #0
sta gDisplayBytes sta gDisplayBytes
jsr PrintByID jsr PrintByID
!byte s_555 !byte s_555
jmp Do555 jmp Do555
.not555
jmp UseUniversal
+ jmp UseUniversal
}
!zone {
PrereadT00 PrereadT00
lda #$0F lda #$0F
PrereadT00Partial PrereadT00Partial
@ -350,10 +369,8 @@ PrereadT00Partial
sta gTrack sta gTrack
sta gAddress sta gAddress
- jsr ReadSector - jsr ReadSector
bcs .exit bcs +
dec gAddress+1 dec gAddress+1
dec gSector dec gSector
bne - bne -
.exit + rts
rts
}

View File

@ -11,27 +11,23 @@
; all other flags clobbered ; all other flags clobbered
; all registers clobbered ; all registers clobbered
;------------------------------- ;-------------------------------
!zone { !macro IDLaureate {
IDLaureate
lda #$00 lda #$00
ldx #$2E ldx #$2E
ldy #$0E ldy #$08
jsr compare ; if T00,S00,$2E == jsr compare ; if T00,S00,$2E ==
!byte $AE,$FF,$08; LDX $08FF !byte $AE,$FF,$08; LDX $08FF
!byte $30,$1E ; BMI +$1E !byte $30,$1E ; BMI +$1E
!byte $E0,$02 ; CPX #$02 !byte $E0,$02 ; CPX #$02
!byte $D0,$05 ; BNE +$05 !byte $D0 ; BNE
!byte $A9,$BF ; LDA #$BF bcs +
!byte $8D,$FE,$08; STA $08FE
bcs .exit
ldx #$F8 ldx #$F8
ldy #$08
jsr compare ; and T00,S00,$F8 == jsr compare ; and T00,S00,$F8 ==
!byte $4C,$00,$B7; JMP $B700 !byte $4C,$00,$B7; JMP $B700
!byte $00,$00,$00 !byte $00,$00,$00
!byte $FF,$0B !byte $FF,$0B
.exit ; passport-test-suite/Sound Ideas- Word Attack - Disk 1 - Ending Consonants.woz [C=0] matches
rts ; passport-test-suite/Sound Ideas- Word Attack - Disk 1 - Ending Consonants.woz [C=0] matches +
} }
;------------------------------- ;-------------------------------

View File

@ -9,8 +9,7 @@
; all registers clobbered ; all registers clobbered
; all other flags clobbered ; all other flags clobbered
;------------------------------- ;-------------------------------
!zone { !macro IDProDOS {
IDProDOS
; Some disks jump to $08FF at $0804 (SOS entry point). ; Some disks jump to $08FF at $0804 (SOS entry point).
; Others have a modified T00,S00 but eventually load ; Others have a modified T00,S00 but eventually load
; ProDOS (e.g. 1-2-3 Sequence Me, Alge-Blaster Plus, ; ProDOS (e.g. 1-2-3 Sequence Me, Alge-Blaster Plus,
@ -24,5 +23,5 @@ IDProDOS
!byte $38 ; SEC !byte $38 ; SEC
!byte $B0,$03 ; BCS +3 !byte $B0,$03 ; BCS +3
!byte $4C ; JMP !byte $4C ; JMP
rts ; passport-test-suite/Investigating Plant Growth.woz [C=0] matches ; passport-test-suite/Investigating Plant Growth.woz [C=0] matches
} }

View File

@ -1,5 +1,5 @@
;------------------------------- ;-------------------------------
; IDRDOS ; IDRDOS16
; identify RDOS 16-sector bootloader ; identify RDOS 16-sector bootloader
; ;
; in: $0800..$08FF contains T00,S00 ; in: $0800..$08FF contains T00,S00
@ -9,7 +9,7 @@
; all registers clobbered ; all registers clobbered
; all other flags clobbered ; all other flags clobbered
;------------------------------- ;-------------------------------
!macro IDRDOS { !macro IDRDOS16 {
lda #$00 lda #$00
tax tax
ldy #$0E ldy #$0E

View File

@ -7,8 +7,7 @@
; IDDOS32 ; IDDOS32
; returns C clear if 3.2/3.3 bootloader detected in T00,S00 ; returns C clear if 3.2/3.3 bootloader detected in T00,S00
;------------------------------- ;-------------------------------
!zone { !macro IDDOS32 {
IDDOS32
lda #$00 lda #$00
tax tax
ldy #$0F ldy #$0F
@ -20,26 +19,26 @@ IDDOS32
!byte $C8 ; INY !byte $C8 ; INY
!byte $D0,$F7 ; BNE - !byte $D0,$F7 ; BNE -
!byte $4C,$0F,$02; JMP $020F !byte $4C,$0F,$02; JMP $020F
bcs .exit bcs +
ldx #$33 ldx #$33
ldy #$08 ldy #$08
jsr compare jsr compare
!byte $A6,$2B ; LDX $2B !byte $A6,$2B ; LDX $2B
!byte $20,$5D,$02; JSR $025D !byte $20,$5D,$02; JSR $025D
!byte $4C,$D1,$02; JMP $02D1 !byte $4C,$D1,$02; JMP $02D1
bcs .exit bcs +
ldx #$F4 ldx #$F4
ldy #$08 ldy #$08
jsr compare jsr compare
!byte $CC,$00,$03; CPY $0300 !byte $CC,$00,$03; CPY $0300
!byte $D0,$03 ; BNE + !byte $D0,$03 ; BNE +
!byte $4C,$3B,$02; JMP $023B !byte $4C,$3B,$02; JMP $023B
bcs .exit bcs +
ldx #$45 ldx #$45
ldy #$03 ldy #$03
jsr compare jsr compare
!byte $4C,$01,$03; JMP $0301 !byte $4C,$01,$03; JMP $0301
.exit rts +
} }
;------------------------------- ;-------------------------------
@ -49,8 +48,7 @@ IDDOS32
; after loading DOS ; after loading DOS
; returns C clear if 3.2lo/3.3 bootloader detected in T00,S00 ; returns C clear if 3.2lo/3.3 bootloader detected in T00,S00
;------------------------------- ;-------------------------------
!zone { !macro IDDOS32LO {
IDDOS32LO
lda #$00 lda #$00
tax tax
ldy #$0F ldy #$0F
@ -62,24 +60,24 @@ IDDOS32LO
!byte $E8 ; INX !byte $E8 ; INX
!byte $D0,$F7 ; BNE - !byte $D0,$F7 ; BNE -
!byte $4C,$0F,$02; JMP $020F !byte $4C,$0F,$02; JMP $020F
bcs .exit bcs +
ldx #$2F ldx #$2F
ldy #$08 ldy #$08
jsr compare jsr compare
!byte $A6,$2B ; LDX $2B !byte $A6,$2B ; LDX $2B
!byte $20,$5D,$02; JSR $025D !byte $20,$5D,$02; JSR $025D
!byte $20,$D1,$02; JSR $02D1 !byte $20,$D1,$02; JSR $02D1
bcs .exit bcs +
ldx #$41 ldx #$41
ldy #$03 ldy #$03
jsr compare jsr compare
!byte $4C,$01,$03; JMP $0301 !byte $4C,$01,$03; JMP $0301
bcc .exit bcc +
ldx #$37 ldx #$37
ldy #$03 ldy #$03
jsr compare jsr compare
!byte $4C,$01,$03; JMP $0301 !byte $4C,$01,$03; JMP $0301
.exit rts +
} }
;------------------------------- ;-------------------------------

View File

@ -7,23 +7,17 @@
; returns C clear if "Special Delivery" bootloader ; returns C clear if "Special Delivery" bootloader
; detected in T00,S00 ; detected in T00,S00
;------------------------------- ;-------------------------------
IDSpecDel !macro IDSpecDel {
lda #$00 lda #$00
tax tax
ldy #$58 ldy #$08
jsr compare jsr compare
!byte $02,$90,$4A,$C6,$27,$BD,$31,$09 !byte $02
!byte $49,$B0,$48,$C6,$3D,$98,$C8,$48 !byte $90,$4A
!byte $CE,$00,$08,$A9,$20,$C6,$27,$48 !byte $C6,$27
!byte $51,$26,$91,$26,$AA,$A5,$27,$85 !byte $BD,$31,$09
!byte $32,$CE,$00,$08,$A8,$B5,$33,$84 ; passport-test-suite/Ernie's Quiz.woz [C=0] matches
!byte $29,$84,$21,$8A,$A2,$17,$86,$31 }
!byte $D5,$33,$A6,$2B,$5D,$31,$09,$85
!byte $29,$5D,$32,$09,$C6,$3D,$85,$28
!byte $5D,$33,$09,$85,$48,$A0,$2B,$84
!byte $20,$C6,$40,$30,$3E,$24,$40,$30
!byte $33,$24,$24,$24,$24,$40,$40,$40
rts
;------------------------------- ;-------------------------------
; TraceSpecDel ; TraceSpecDel

View File

@ -75,11 +75,11 @@ NonRelocatable
!source "id/dinkeydos.a" !source "id/dinkeydos.a"
!source "id/advent.a" !source "id/advent.a"
!source "id/panglosdos.a" !source "id/panglosdos.a"
!source "id/bootfailure.a"
!source "id/davidson.a" !source "id/davidson.a"
!source "id/holle.a" !source "id/holle.a"
!source "id/phoenix.a" !source "id/phoenix.a"
!source "id/555.a" !source "id/555.a"
!source "id/bootfailure.a"
!source "id/inspect0.a" !source "id/inspect0.a"
!source "print.a" !source "print.a"
!source "compare.a" !source "compare.a"