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
; - The Tracer Sanction
;-------------------------------
IDAdvent
!macro IDAdvent {
lda #BASEPAGE
ldy #33
jsr SearchSector
@ -33,7 +33,8 @@ IDAdvent
!byte $D0,$F5 ;BNE $-8
!byte $A6,$2B ;LDX $2B
!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
;

View File

@ -10,34 +10,19 @@
;
; module by qkumba
;-------------------------------
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 +
!macro IDEA {
lda #$00
tax
ldy #16
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 $10,$8A,$9D,$EF,$03,$CA,$D0,$F9
+ rts
+
}
foundea
;

View File

@ -10,13 +10,12 @@
; all registers clobbered
; all other flags clobbered
;-------------------------------
!zone {
IDEncoded44
!macro IDEncoded44 {
ldy #$07
jsr SearchTrack
!byte $BD,$8C,$C0
!byte $10,$FB
!byte $38
!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 other flags clobbered
;-------------------------------
!zone {
IDEncoded53
!macro IDEncoded53 {
ldy #$10
jsr SearchTrack
!byte $BD,$8C,$C0,$10,$FB,$C9,$B5,$F0
!byte $09,$28,$90,$DF,$49,$AD,$F0,$1F
rts
}

View File

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

View File

@ -11,27 +11,23 @@
; all other flags clobbered
; all registers clobbered
;-------------------------------
!zone {
IDLaureate
!macro IDLaureate {
lda #$00
ldx #$2E
ldy #$0E
ldy #$08
jsr compare ; if T00,S00,$2E ==
!byte $AE,$FF,$08; LDX $08FF
!byte $30,$1E ; BMI +$1E
!byte $E0,$02 ; CPX #$02
!byte $D0,$05 ; BNE +$05
!byte $A9,$BF ; LDA #$BF
!byte $8D,$FE,$08; STA $08FE
bcs .exit
!byte $D0 ; BNE
bcs +
ldx #$F8
ldy #$08
jsr compare ; and T00,S00,$F8 ==
!byte $4C,$00,$B7; JMP $B700
!byte $00,$00,$00
!byte $FF,$0B
.exit
rts ; passport-test-suite/Sound Ideas- Word Attack - Disk 1 - Ending Consonants.woz [C=0] matches
; 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 other flags clobbered
;-------------------------------
!zone {
IDProDOS
!macro 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,
@ -24,5 +23,5 @@ IDProDOS
!byte $38 ; SEC
!byte $B0,$03 ; BCS +3
!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
;
; in: $0800..$08FF contains T00,S00
@ -9,7 +9,7 @@
; all registers clobbered
; all other flags clobbered
;-------------------------------
!macro IDRDOS {
!macro IDRDOS16 {
lda #$00
tax
ldy #$0E

View File

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

View File

@ -7,23 +7,17 @@
; returns C clear if "Special Delivery" bootloader
; detected in T00,S00
;-------------------------------
IDSpecDel
!macro IDSpecDel {
lda #$00
tax
ldy #$58
ldy #$08
jsr compare
!byte $02,$90,$4A,$C6,$27,$BD,$31,$09
!byte $49,$B0,$48,$C6,$3D,$98,$C8,$48
!byte $CE,$00,$08,$A9,$20,$C6,$27,$48
!byte $51,$26,$91,$26,$AA,$A5,$27,$85
!byte $32,$CE,$00,$08,$A8,$B5,$33,$84
!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
!byte $02
!byte $90,$4A
!byte $C6,$27
!byte $BD,$31,$09
; passport-test-suite/Ernie's Quiz.woz [C=0] matches
}
;-------------------------------
; TraceSpecDel

View File

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