shave some bytes

This commit is contained in:
4am 2021-06-19 19:42:56 -04:00
parent 72f4ffb7d7
commit aabfb0118a
11 changed files with 160 additions and 170 deletions

View File

@ -9,26 +9,24 @@
; D5D5F7 protection check, so we can save time by
; not doing full-track searches on those disks.
;
; in: $0800..$08FF contains T00,S00
; IDDOS33 returned success
; out: C clear if specific version of DOS 3.3 bootloader found
; C set otherwise
; X,Y preserved
; all other flags and registers clobbered
; in: $0800..$08FF contains T00,S00
; IDDOS33 returned success
; A = 0
; out: A,Y preserved
; all other flags and registers clobbered
;-------------------------------
!macro IDD5D5F7 {
lda #$08
cmp $08F2
ldx #$08
cpx $08F2
beq @d5yes ; passport-test-suite/Trivia Fever (BB03 variant 3).woz [Z=1] matches
cmp $084C
cpx $084C
bne @d5no
lda $08B0
cmp #$B6
ldx $08B0
cpx #$B6
bne @d5no
lda $08D0
cmp #$20
ldx $08D0
cpx #$20
bne @d5no
@d5yes lda #TRUE
sta gPossibleD5D5F7 ; passport-test-suite/RoboMath.woz [Z=1] matches
@d5yes sta gPossibleD5D5F7 ; passport-test-suite/RoboMath.woz [Z=1] matches
@d5no
}

View File

@ -2,22 +2,21 @@
; IDDiversi
; identify Diversi-DOS bootloader
;
; in: $0800..$08FF contains T00,S00
; first page of track buffer also contains T00,S00
; bootloader was identified as DOS 3.3-shaped (IDDOS33 returned success)
; out: C clear if Diversi-DOS bootloader found
; C set otherwise
; all registers clobbered
; all other flags clobbered
; in: $0800..$08FF contains T00,S00
; first page of track buffer also contains T00,S00
; bootloader was identified as DOS 3.3-shaped (IDDOS33 returned success)
; A = 0
; out: C clear if Diversi-DOS bootloader found
; C set otherwise
; A = 0
; all other registers & flags clobbered
;-------------------------------
!macro IDDiversi {
lda #$00
ldx #$F1
ldy #$0B
jsr compare ; if T00,S00,$F1 ==
!byte $B3,$A3,$A0,$D2,$CF,$D2,$D2,$C5,$8D,$87,$8D
bcs + ; passport-test-suite/Moon Bingo.woz [C=0] matches
;lda #TRUE
sta gIsDiversi
+
}

View File

@ -3,14 +3,15 @@
; identify DOS 3.3 bootloader or some variation
; that can be safely boot traced
;
; in: $0800..$08FF contains T00,S00
; first page of track buffer also contains T00,S00
; out: C clear if traceable DOS 3.3-style bootloader found
; C set otherwise
; all registers clobbered
; all other flags clobbered
; in: $0800..$08FF contains T00,S00
; first page of track buffer also contains T00,S00
; A = 0
; X = 0
; out: C clear if traceable DOS 3.3-style bootloader found
; C set otherwise
; A = 0
; all other registers & flags clobbered
;-------------------------------
!zone {
IDDOS33
;
; $08FE must be either $B6 (standard) or $20..$36
@ -19,20 +20,19 @@ IDDOS33
; Must weed out some Infocom and TLC disks that would
; load over program space and crash.
;
lda $08FE
cmp #$B6
beq ++ ; passport-test-suite/Binomial Multiplication.woz [Z=1] here, loads at $B600
cmp #$37
ldy $08FE
cpy #$B6
beq @ok08FE ; passport-test-suite/Binomial Multiplication.woz [Z=1] here, loads at $B600
cpy #$37
bcc + ; passport-test-suite/Beach-Head.woz [C=0] here, loads at $3F00
- sec
@fail sec
rts
+ cmp #$20
bcc - ; passport-test-suite/Alf.woz [C=0] here, loads at $1300
+ cpy #$20
bcc @fail ; passport-test-suite/Alf.woz [C=0] here, loads at $1300
@ok08FE
;
; Code at $0801 must be standard (with one exception)
; Code at $0800 must be standard (with one exception)
;
++ lda #$00
tax
ldy #$3F
jsr compare ; if T00,S00,$00 ==
!byte $01
@ -66,14 +66,10 @@ IDDOS33
!byte $6C,$3E,$00
!byte $EE,$FE,$08
!byte $EE,$FE,$08
bcc + ; passport-test-suite/Binomial Multiplication.woz [C=0] matches
jmp .exit
+
bcs @fail ; passport-test-suite/Binomial Multiplication.woz [C=0] matches
;
; DOS 3.3 has JSR $FE89 / JSR $FE93 / JSR $FB2F
; DOS 3.3 and most derivatives have JSR $FE89 / JSR $FE93 / JSR $FB2F at $083F
;
;A=0 here
;lda #$00
ldx #$3F
ldy #$0B
jsr compare ; if T00,S00,$3F ==
@ -81,78 +77,61 @@ IDDOS33
!byte $20,$93,$FE
!byte $20,$2F,$FB
!byte $A6,$2B
bcc + ; passport-test-suite/Binomial Multiplication.woz [C=0] matches
bcc @ok083F ; passport-test-suite/Binomial Multiplication.woz [C=0] matches
;
; some Sierra have STA $C050 / STA $C057 / STA $C055 instead
; Sierra variants have STA $C050 / STA $C057 / STA $C055 at $083F
;
;A=0 here
;lda #$00
ldx #$3F
ldy #$0B
jsr compare ; if T00,S00,$3F ==
!byte $8D,$50,$C0
!byte $8D,$57,$C0
!byte $8D,$55,$C0
!byte $A6,$2B
bcs .exit
+
bcs @exit ; passport-test-suite/Leisure Suit Larry.woz [C=0] matches
; other variations -> failure
@ok083F
;
; Check sector order map
; Filter out unsupported sector order map
;
;A=0 here
;lda #$00
ldx #$4D ; passport-test-suite/Leisure Suit Larry.woz [C=0] matches previous compare
ldx #$4D
ldy #$10
jsr compare ; if T00,S00,$4D ==
!byte $00,$0D,$0B,$09,$07,$05,$03,$01
!byte WILDCARD,$0C,$0A,$08,$06,$04,$02,$0F
bcs .exit ; passport-test-suite/Pitfall II.woz [C=1] because of non-standard sector map
bcs @exit ; passport-test-suite/Pitfall II.woz [C=1] here
;
; Check for MUSE sector order map
; Check for MUSE sector order map (nonstandard but supported)
;
ldy $0855
cpy #$02
bne +
ldy #TRUE ; passport-test-suite/The Function Game.woz [C=0] matches previous compare
sty gIsMUSERWTS
bne @notMUSE ; passport-test-suite/The Function Game.woz [Z=0] matches
sta gIsMUSERWTS
ldy #$0E
sty precheck_sectors+1
ldy #kSectorIgnore
sty T00S08
sty T00S0F
+
@notMUSE
;
; Minor variant jumps to $08F0 and back but is still safe to trace.
; Check for this jump and match the code at $08F0 exactly.
; DOS 3.3 and most derivatives have STA $08FE at $081C
;
;A=0 here
;lda #$00
ldx #$1C
ldy #$03
jsr compare ; if T00,S00,$1C ==
!byte $8D,$FE,$08
; standard code at $081C -> success
bcc .exit ; passport-test-suite/Binomial Multiplication.woz [C=0] matches
;A=0 here
;lda #$00
ldx #$1C
ldy #$03
bcc @exit ; passport-test-suite/Binomial Multiplication.woz [C=0] matches
;
; Variant jumps to $08F0 and back but is still safe to trace.
; Check for this jump and also match the code at $08F0 exactly.
;
jsr compare ; if T00,S00,$1C ==
!byte $4C,$F0,$08; JMP $08F0
bcs .exit ; unknown code at $081C -> failure
;A=0 here
;lda #$00
bcs @exit ; unknown code at $081C -> failure
ldx #$F0
ldy #$09
jsr compare ; if T00,S00,$F0 ==
!byte $8D,$FE,$08
!byte $EE,$F3,$03
!byte $4C,$1F,$08
; passport-test-suite/Library Magic.woz [C=0] matches acceptable code at $08F0
; unknown code at $08F0 -> failure
.exit
rts ; passport-test-suite/Library Magic.woz [C=0] matches acceptable code at $08F0
}
@exit rts

View File

@ -2,17 +2,18 @@
; IDEA
; identify Electronic Arts custom bootloader
;
; in: track buffer contains T00,S00
; out: C clear if EA bootloader was found
; C set if not found
; all other flags clobbered
; all registers clobbered
; in: track buffer contains T00,S00
; A = 0
; X = 0
; out: C clear if EA bootloader was found
; C set if not found
; A = 0
; X = 0
; all other registers & flags clobbered
;
; module by qkumba
;-------------------------------
!macro IDEA {
lda #$00
tax
ldy #16
jsr compare
!byte $05,$4C,$04,$08,$A9,$00,$8D,$F2

View File

@ -77,7 +77,8 @@ IDBootloader
lda #$08
ldx #BASEPAGE
ldy #$01
jsr CopyMemory
jsr CopyMemory ; exits with X=0
txa ; A=0
;
; Try to identify DOS 3.3-shaped bootloader.
; Exit via custom trace function if found.
@ -88,15 +89,15 @@ IDBootloader
sta gIsBoot0
+IDD5D5F7
+IDDiversi
lda #s_diversidos
ldx #s_diversidos
bcc .printdos
+IDPronto
lda #s_prontodos
ldx #s_prontodos
bcc .printdos
lda #s_dosb0
ldx #s_dosb0
.printdos
sta +
stx +
jsr PrintByID
+ !byte $FD ; SMC
jmp TraceDOS33
@ -106,19 +107,33 @@ IDBootloader
; early to munge the nibble tables used by the drive firmware.
; Exit via custom trace function if found.
;
jsr ID8b3
+ID8b3
bcs .not8b3
jsr PrintByID
!byte s_jsr8b3
lda #TRUE
sta gIs8b3
jmp Trace8B3
.not8b3
;
; Try to identify Laureate Learning Systems bootloader.
; Exit via custom trace function if found.
;
+IDLaureate
bcs .notLaureate
jsr PrintByID
!byte s_laureate
lda #TRUE
sta gIsLaureate
lda #$0B
jsr PrereadT00Partial
bcs .notLaureate
jmp TraceLaureate
.notLaureate
;
; Try to identify all the different MECC fastloader variants.
; Exit via custom trace function if found.
;
jsr IDMECC
+IDMECC
bcs .notmecc
lda #ID_MECC_UNK
sta gMECCFastloadType
@ -158,21 +173,6 @@ IDBootloader
jmp TraceSpecDel
.notSpecialDelivery
;
; Try to identify Laureate Learning Systems bootloader.
; Exit via custom trace function if found.
;
+IDLaureate
bcs .notLaureate
jsr PrintByID
!byte s_laureate
lda #TRUE
sta gIsLaureate
lda #$0B
jsr PrereadT00Partial
bcs .notLaureate
jmp TraceLaureate
.notLaureate
;
; Try to identify Electronic Arts bootloader.
; Exit via custom trace function if found.
;
@ -181,14 +181,6 @@ IDBootloader
jmp foundea
.notEA
;
; Try to identify Interplay bootloader.
; Exit via custom trace function if found.
;
+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.
@ -206,6 +198,14 @@ IDBootloader
jmp TraceDOS32LO
.notDOS32LO
;
; Try to identify Interplay bootloader.
; Exit via custom trace function if found.
;
+IDAdvent
bcs .notInterplay
jmp foundadvent
.notInterplay
;
; 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.

View File

@ -4,20 +4,19 @@
; to alter the nibble translate table used
; by the drive firmware at $C600
;
; in: track buffer contains T00,S00
; out: C clear if this bootloader was found
; C set otherwise
; all other flags clobbered
; all registers clobbered
; in: track buffer contains T00,S00
; A = 0
; out: C clear if this bootloader was found
; C set otherwise
; A = 0
; all other registers & flags clobbered
;-------------------------------
!zone {
ID8b3
lda #$00
!macro ID8b3 {
tax
ldy #$08
jsr compare
!byte $01,$20,$B3,$08,$D0,$19,$EA,$A5
bcs .exit
bcs +
ldx #$B3
ldy #$14
@ -26,6 +25,6 @@ ID8b3
!byte $A9,$1C,$8D,$CC,$03
!byte $A9,$00,$8D,$D5,$03
!byte $A9,$37,$8D,$A3,$03
.exit
rts ; passport-test-suite/Ardy The Aardvark.woz [C=0] matches
; passport-test-suite/Ardy The Aardvark.woz [C=0] matches
+
}

View File

@ -4,15 +4,14 @@
; Laureate Learning Systems
; loads RWTS directly into language card
;
; in: track buffer contains T00,S00
; out: C clear if Laureate bootloader was found
; (and track buffer now contains all of track 0)
; C set if not found
; all other flags clobbered
; all registers clobbered
; in: track buffer contains T00,S00
; A = 0
; out: C clear if Laureate bootloader was found
; C set if not found
; A = 0
; all other registers & flags clobbered
;-------------------------------
!macro IDLaureate {
lda #$00
ldx #$2E
ldy #$08
jsr compare ; if T00,S00,$2E ==

View File

@ -6,23 +6,22 @@
; are required to distinguish between them after
; this function matches
;
; in: track buffer contains T00,S00
; out: C clear if MECC bootloader was found
; (and track buffer now contains all of track 0)
; C set if not found
; all other flags clobbered
; all registers clobbered
; in: track buffer contains T00,S00
; A = 0
; out: C clear if MECC bootloader was found
; C set if not found
; A = 0
; X = 0
; all other registers & flags clobbered
;-------------------------------
!zone {
IDMECC
lda #$00
!macro IDMECC {
tax
ldy #$17
jsr compare
!byte $01,$4C,$1A,$08,$17,$0F,$00,$00
!byte $0D,$0B,$09,$07,$05,$03,$01,$0E
!byte $0C,$0A,$08,$06,$04,$02,$0F
rts ; passport-test-suite/Clock Works v1.0.woz [C=0] matches
; passport-test-suite/Clock Works v1.0.woz [C=0] matches
}
;-------------------------------

View File

@ -2,16 +2,16 @@
; IDPronto
; identify Pronto-DOS bootloader
;
; in: $0800..$08FF contains T00,S00
; first page of track buffer also contains T00,S00
; bootloader was identified as DOS 3.3-shaped (IDDOS33 returned success)
; out: C clear if Pronto-DOS bootloader found
; C set otherwise
; all registers clobbered
; all other flags clobbered
; in: $0800..$08FF contains T00,S00
; first page of track buffer also contains T00,S00
; bootloader was identified as DOS 3.3-shaped (IDDOS33 returned success)
; A = 0
; out: C clear if Pronto-DOS bootloader found
; C set otherwise
; A = 0
; all other flags clobbered
;-------------------------------
!macro IDPronto {
lda #$00
ldx #$5E
ldy #$07
jsr compare ; if T00,S00,$5E ==

View File

@ -5,13 +5,18 @@
;-------------------------------
; IDDOS32
; returns C clear if 3.2/3.3 bootloader detected in T00,S00
;
; in: $0800..$08FF contains T00,S00
; first page of track buffer also contains T00,S00
; A = 0
; X = 0
; out: C clear if hybrid DOS 3.2/3.3 bootloader found
; C set otherwise
; all other registers & flags clobbered
;-------------------------------
!macro IDDOS32 {
lda #$00
tax
ldy #$0F
jsr compare
jsr compare ; if T00,S00,$00 =
!byte $01
!byte $A0,$0F ; LDY #$0F
!byte $B9,$00,$08; LDA $0800,Y
@ -22,21 +27,21 @@
bcs +
ldx #$33
ldy #$08
jsr compare
jsr compare ; and T00,S00,$33 =
!byte $A6,$2B ; LDX $2B
!byte $20,$5D,$02; JSR $025D
!byte $4C,$D1,$02; JMP $02D1
bcs +
ldx #$F4
ldy #$08
jsr compare
jsr compare ; and T00,S00,$F4 =
!byte $CC,$00,$03; CPY $0300
!byte $D0,$03 ; BNE +
!byte $4C,$3B,$02; JMP $023B
bcs +
ldx #$45
ldy #$03
jsr compare
jsr compare ; and T00,S00,$45 =
!byte $4C,$01,$03; JMP $0301
+
}
@ -46,7 +51,12 @@
; detect earlier variant of hybrid bootloader that loads into
; low memory ($3600) then relocates to the top of main memory
; after loading DOS
; returns C clear if 3.2lo/3.3 bootloader detected in T00,S00
; in: $0800..$08FF contains T00,S00
; first page of track buffer also contains T00,S00
; out: C clear if low DOS 3.2/3.3 bootloader found
; C set otherwise
; all other registers & flags clobbered
;-------------------------------
!macro IDDOS32LO {
lda #$00

View File

@ -4,11 +4,17 @@
;-------------------------------
; IDSpecDel
; returns C clear if "Special Delivery" bootloader
; detected in T00,S00
;
; in: $0800..$08FF contains T00,S00
; first page of track buffer also contains T00,S00
; A = 0
; out: C clear if Special Delivery bootloader found
; C set otherwise
; A = 0
; X = 0
; all other registers & flags clobbered
;-------------------------------
!macro IDSpecDel {
lda #$00
tax
ldy #$08
jsr compare