mirror of
https://github.com/a2-4am/passport.git
synced 2024-12-22 19:30:50 +00:00
refactor DOS 3.3 ID
This commit is contained in:
parent
8a89f62674
commit
ff2af65bb8
145
src/id/dos33.a
145
src/id/dos33.a
@ -12,82 +12,99 @@
|
|||||||
;-------------------------------
|
;-------------------------------
|
||||||
!zone {
|
!zone {
|
||||||
IDDOS33
|
IDDOS33
|
||||||
lda $08FE ; $08FE must be either $36 or $B6
|
;
|
||||||
cmp #$36 ; (prevents matching on some
|
; $08FE must be either $36 or $B6 (prevents matching on some
|
||||||
beq .match0 ; Infocom disks that would
|
; Infocom disks that would otherwise match but then load
|
||||||
cmp #$B6 ; otherwise match but then load
|
; boot1 over program space and crash)
|
||||||
beq .match0 ; boot1 over program space and crash)
|
;
|
||||||
jmp .notd33boot0
|
lda $08FE
|
||||||
|
cmp #$36
|
||||||
.match0
|
beq +
|
||||||
lda #$00 ; match first $1C bytes of T00S00
|
cmp #$B6
|
||||||
ldx #$00 ; against standard DOS 3.3 boot0
|
beq +
|
||||||
ldy #$1C
|
sec
|
||||||
jsr compare
|
rts
|
||||||
!byte $01,$A5,$27,$C9,$09,$D0,$18,$A5
|
;
|
||||||
!byte $2B,$4A,$4A,$4A,$4A,$09,$C0,$85
|
; Code at $0801 must be standard (with one exception)
|
||||||
!byte $3F,$A9,$5C,$85,$3E,$18,$AD,$FE
|
;
|
||||||
!byte $08,$6D,$FF,$08
|
+ lda #$00
|
||||||
bcc .maybe_d33_1
|
ldx #$00
|
||||||
jmp .notd33boot0
|
ldy #$4A
|
||||||
|
jsr compare ; if T00,S00,$00 ==
|
||||||
.maybe_d33_1
|
!byte $01
|
||||||
lda #$00 ; match more bytes of T00S00
|
!byte $A5,$27
|
||||||
ldx #$1F ; against standard DOS 3.3 boot0
|
!byte $C9,$09
|
||||||
ldy #$2B
|
!byte $D0,$18
|
||||||
jsr compare
|
!byte $A5,$2B
|
||||||
!byte $AE
|
!byte $4A
|
||||||
!byte $FF,$08,$30,$15,$BD,$4D,$08,$85
|
!byte $4A
|
||||||
!byte $3D,$CE,$FF,$08,$AD,$FE,$08,$85
|
!byte $4A
|
||||||
!byte $27,$CE,$FE,$08,$A6,$2B,$6C,$3E
|
!byte $4A
|
||||||
!byte $00,$EE,$FE,$08,$EE,$FE,$08,$20
|
!byte $09,$C0
|
||||||
!byte $89,$FE,$20,$93,$FE,$20,$2F,$FB
|
!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
|
!byte $A6,$2B
|
||||||
bcc .maybe_d33_2
|
!byte $6C,$3E,$00
|
||||||
jmp .notd33boot0
|
!byte $EE,$FE,$08
|
||||||
|
!byte $EE,$FE,$08
|
||||||
.maybe_d33_2
|
!byte $20,$89,$FE
|
||||||
lda #$00 ; check sector order map
|
!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
|
ldx #$4D
|
||||||
ldy #$10
|
ldy #$10
|
||||||
jsr compare
|
jsr compare ; if T00,S00,$4D ==
|
||||||
!byte $00,$0D,$0B,$09,$07,$05,$03,$01
|
!byte $00,$0D,$0B,$09,$07,$05,$03,$01
|
||||||
!byte $0E,$0C,$0A,$08,$06,$04,$02,$0F
|
!byte $0E,$0C,$0A,$08,$06,$04,$02,$0F
|
||||||
bcc .maybe_d33_3
|
bcs .exit
|
||||||
jmp .notd33boot0
|
;
|
||||||
|
; Minor variant (e.g. Terrapin Logo 3.0) jumps to $08F0 and back
|
||||||
.maybe_d33_3
|
; but is still safe to trace. Check for this jump and match
|
||||||
lda #$00 ; match 3 final bytes of T00S00
|
; the code at $08F0 exactly.
|
||||||
ldx #$1C ; against standard DOS 3.3 boot0
|
;
|
||||||
|
lda #$00
|
||||||
|
ldx #$1C
|
||||||
ldy #$03
|
ldy #$03
|
||||||
jsr compare
|
jsr compare ; if T00,S00,$1C ==
|
||||||
!byte $8D,$FE,$08
|
!byte $8D,$FE,$08
|
||||||
bcs .maybe_d33_4
|
bcc .exit ; standard code at $081C -> success
|
||||||
jmp .founddos33
|
|
||||||
|
|
||||||
.maybe_d33_4
|
lda #$00
|
||||||
lda #$00 ; minor variation (e.g. Terrapin
|
ldx #$1C
|
||||||
ldx #$1C ; Logo 3.0) jumps to $08F0 and
|
ldy #$03
|
||||||
ldy #$03 ; back, but still safe to trace
|
jsr compare ; if T00,S00,$1C ==
|
||||||
jsr compare
|
!byte $4C,$F0,$08; JMP $08F0
|
||||||
!byte $4C,$F0,$08
|
bcs .exit ; unknown code at $081C -> failure
|
||||||
bcc .maybe_d33_5
|
|
||||||
jmp .notd33boot0
|
|
||||||
|
|
||||||
.maybe_d33_5
|
|
||||||
lda #$00
|
lda #$00
|
||||||
ldx #$F0
|
ldx #$F0
|
||||||
ldy #$09
|
ldy #$09
|
||||||
jsr compare
|
jsr compare ; if T00,S00,$F0 ==
|
||||||
!byte $8D,$FE,$08,$EE,$F3,$03,$4C,$1F
|
!byte $8D,$FE,$08
|
||||||
!byte $08
|
!byte $EE,$F3,$03
|
||||||
bcs .notd33boot0
|
!byte $4C,$1F,$08
|
||||||
|
; bcs .exit ; unknown code at $08F0 -> failure
|
||||||
|
|
||||||
.founddos33
|
.exit
|
||||||
clc
|
|
||||||
!byte $24 ; hide next SEC
|
|
||||||
|
|
||||||
.notd33boot0
|
|
||||||
sec
|
|
||||||
rts
|
rts
|
||||||
}
|
}
|
||||||
|
@ -33,8 +33,7 @@ IDBootloader
|
|||||||
bcc ++
|
bcc ++
|
||||||
cmp #$05
|
cmp #$05
|
||||||
beq ++
|
beq ++
|
||||||
+
|
+ jmp UseUniversal
|
||||||
- jmp UseUniversal
|
|
||||||
|
|
||||||
++
|
++
|
||||||
;
|
;
|
||||||
@ -46,31 +45,6 @@ IDBootloader
|
|||||||
ldy #$01
|
ldy #$01
|
||||||
jsr CopyMemory
|
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
|
lda #$00
|
||||||
ldx #$00
|
ldx #$00
|
||||||
ldy #$05
|
ldy #$05
|
||||||
@ -99,7 +73,7 @@ IDBootloader
|
|||||||
; The wildcard in 7th position catches alternate jump
|
; The wildcard in 7th position catches alternate jump
|
||||||
; addresses (e.g. Wizardry I, Sundog Frozen Legacy)
|
; 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
|
ldx #TRUE
|
||||||
bcc .pascal
|
bcc .pascal
|
||||||
lda #$00
|
lda #$00
|
||||||
@ -122,6 +96,8 @@ IDBootloader
|
|||||||
;
|
;
|
||||||
jsr IDDOS33
|
jsr IDDOS33
|
||||||
bcs .notdos33
|
bcs .notdos33
|
||||||
|
lda #TRUE
|
||||||
|
sta gIsBoot0
|
||||||
lda #s_dosb0
|
lda #s_dosb0
|
||||||
jsr PrintByID
|
jsr PrintByID
|
||||||
jmp TraceDOS33
|
jmp TraceDOS33
|
||||||
|
Loading…
Reference in New Issue
Block a user