diff --git a/src/id/dos33.a b/src/id/dos33.a index 174022b..cd3a08a 100755 --- a/src/id/dos33.a +++ b/src/id/dos33.a @@ -12,82 +12,99 @@ ;------------------------------- !zone { IDDOS33 - lda $08FE ; $08FE must be either $36 or $B6 - cmp #$36 ; (prevents matching on some - beq .match0 ; Infocom disks that would - cmp #$B6 ; otherwise match but then load - beq .match0 ; boot1 over program space and crash) - jmp .notd33boot0 - -.match0 - lda #$00 ; match first $1C bytes of T00S00 - ldx #$00 ; against standard DOS 3.3 boot0 - ldy #$1C - jsr compare - !byte $01,$A5,$27,$C9,$09,$D0,$18,$A5 - !byte $2B,$4A,$4A,$4A,$4A,$09,$C0,$85 - !byte $3F,$A9,$5C,$85,$3E,$18,$AD,$FE - !byte $08,$6D,$FF,$08 - bcc .maybe_d33_1 - jmp .notd33boot0 - -.maybe_d33_1 - lda #$00 ; match more bytes of T00S00 - ldx #$1F ; against standard DOS 3.3 boot0 - ldy #$2B - jsr compare - !byte $AE - !byte $FF,$08,$30,$15,$BD,$4D,$08,$85 - !byte $3D,$CE,$FF,$08,$AD,$FE,$08,$85 - !byte $27,$CE,$FE,$08,$A6,$2B,$6C,$3E - !byte $00,$EE,$FE,$08,$EE,$FE,$08,$20 - !byte $89,$FE,$20,$93,$FE,$20,$2F,$FB +; +; $08FE must be either $36 or $B6 (prevents matching on some +; Infocom disks that would otherwise match but then load +; boot1 over program space and crash) +; + lda $08FE + cmp #$36 + beq + + cmp #$B6 + beq + + sec + rts +; +; Code at $0801 must be standard (with one exception) +; ++ lda #$00 + ldx #$00 + ldy #$4A + jsr compare ; if T00,S00,$00 == + !byte $01 + !byte $A5,$27 + !byte $C9,$09 + !byte $D0,$18 + !byte $A5,$2B + !byte $4A + !byte $4A + !byte $4A + !byte $4A + !byte $09,$C0 + !byte $85,$3F + !byte $A9,$5C + !byte $85,$3E + !byte $18 + !byte $AD,$FE,$08 + !byte $6D,$FF,$08 + !byte WILDCARD ; will check these later + !byte WILDCARD + !byte WILDCARD + !byte $AE,$FF,$08 + !byte $30,$15 + !byte $BD,$4D,$08 + !byte $85,$3D + !byte $CE,$FF,$08 + !byte $AD,$FE,$08 + !byte $85,$27 + !byte $CE,$FE,$08 !byte $A6,$2B - bcc .maybe_d33_2 - jmp .notd33boot0 - -.maybe_d33_2 - lda #$00 ; check sector order map + !byte $6C,$3E,$00 + !byte $EE,$FE,$08 + !byte $EE,$FE,$08 + !byte $20,$89,$FE + !byte $20,$93,$FE + !byte $20,$2F,$FB + !byte $A6,$2B + bcs .exit +; +; Sector order map must be standard (no exceptions) +; + lda #$00 ldx #$4D ldy #$10 - jsr compare + jsr compare ; if T00,S00,$4D == !byte $00,$0D,$0B,$09,$07,$05,$03,$01 !byte $0E,$0C,$0A,$08,$06,$04,$02,$0F - bcc .maybe_d33_3 - jmp .notd33boot0 - -.maybe_d33_3 - lda #$00 ; match 3 final bytes of T00S00 - ldx #$1C ; against standard DOS 3.3 boot0 + bcs .exit +; +; Minor variant (e.g. Terrapin Logo 3.0) jumps to $08F0 and back +; but is still safe to trace. Check for this jump and match +; the code at $08F0 exactly. +; + lda #$00 + ldx #$1C ldy #$03 - jsr compare + jsr compare ; if T00,S00,$1C == !byte $8D,$FE,$08 - bcs .maybe_d33_4 - jmp .founddos33 + bcc .exit ; standard code at $081C -> success -.maybe_d33_4 - lda #$00 ; minor variation (e.g. Terrapin - ldx #$1C ; Logo 3.0) jumps to $08F0 and - ldy #$03 ; back, but still safe to trace - jsr compare - !byte $4C,$F0,$08 - bcc .maybe_d33_5 - jmp .notd33boot0 + lda #$00 + ldx #$1C + ldy #$03 + jsr compare ; if T00,S00,$1C == + !byte $4C,$F0,$08; JMP $08F0 + bcs .exit ; unknown code at $081C -> failure -.maybe_d33_5 lda #$00 ldx #$F0 ldy #$09 - jsr compare - !byte $8D,$FE,$08,$EE,$F3,$03,$4C,$1F - !byte $08 - bcs .notd33boot0 + jsr compare ; if T00,S00,$F0 == + !byte $8D,$FE,$08 + !byte $EE,$F3,$03 + !byte $4C,$1F,$08 +; bcs .exit ; unknown code at $08F0 -> failure -.founddos33 - clc - !byte $24 ; hide next SEC - -.notd33boot0 - sec +.exit rts } diff --git a/src/id/inspect0.a b/src/id/inspect0.a index 325d536..5553126 100755 --- a/src/id/inspect0.a +++ b/src/id/inspect0.a @@ -33,8 +33,7 @@ IDBootloader bcc ++ cmp #$05 beq ++ -+ -- jmp UseUniversal ++ jmp UseUniversal ++ ; @@ -46,31 +45,6 @@ IDBootloader ldy #$01 jsr CopyMemory - lda #$00 - ldx #$00 - ldy #$4A - jsr compare ; if T00,S00,$00 == - -; This needs to be pretty strict because, if it matches, -; we're going to patch the sector and trace it to capture -; the RWTS. - - !byte $01,$A5,$27,$C9,$09,$D0,$18,$A5 - !byte $2B,$4A,$4A,$4A,$4A,$09,$C0,$85 - !byte $3F,$A9,$5C,$85,$3E,$18,$AD,$FE - !byte $08,$6D,$FF,$08,$8D,$FE,$08,$AE - !byte $FF,$08,$30,$15,$BD,$4D,$08,$85 - !byte $3D,$CE,$FF,$08,$AD,$FE,$08,$85 - !byte $27,$CE,$FE,$08,$A6,$2B,$6C,$3E - !byte $00,$EE,$FE,$08,$EE,$FE,$08,$20 - !byte $89,$FE,$20,$93,$FE,$20,$2F,$FB - !byte $A6,$2B - ldx #TRUE - bcc .boot0 - ldx #FALSE -.boot0 - stx gIsBoot0 - lda #$00 ldx #$00 ldy #$05 @@ -99,7 +73,7 @@ IDBootloader ; The wildcard in 7th position catches alternate jump ; addresses (e.g. Wizardry I, Sundog Frozen Legacy) - !byte $01,$E0,$60,$F0,$03,$4C,$97,$08 + !byte $01,$E0,$60,$F0,$03,$4C,WILDCARD,$08 ldx #TRUE bcc .pascal lda #$00 @@ -122,6 +96,8 @@ IDBootloader ; jsr IDDOS33 bcs .notdos33 + lda #TRUE + sta gIsBoot0 lda #s_dosb0 jsr PrintByID jmp TraceDOS33