passport/src/id/mecc.a
2021-07-09 20:14:08 -04:00

305 lines
8.2 KiB
Plaintext
Executable File

;-------------------------------
; IDMECC
; identify MECC custom bootloader
; note: there are several MECC RWTSes that share
; the same early bootloader, so further checks
; are required to distinguish between them after
; this function matches
;
; in: track buffer contains T00,S00
; A = 0
; X = 0
; out: C clear if MECC bootloader was found
; C set if not found
; A = 0
; X = 0
; all other registers & flags clobbered
;-------------------------------
!macro IDMECC {
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
; passport-test-suite/Clock Works v1.0.woz [C=0] matches
}
;-------------------------------
; IDMECC1
; identify MECC bootloader variant #1
; (labeled "M8" on original disks)
;
; in: track buffer contains all of track 0
; out: C clear if MECC "M8" bootloader was found
; C set if not found
; all other flags clobbered
; all registers clobbered
;-------------------------------
!zone {
IDMECC1
lda #$0B
ldx #$02
ldy #$06
jsr compare ; IF T00,S0B,$02 ==
!byte $BD,$8C,$C0,$10,$FB,$C9
bcs .exit
ldx #$89
jsr compare ; AND T00,S0B,$89 ==
!byte $BD,$8C,$C0,$10,$FB,$C9
bcs .exit
ldx #$09
ldy #$09
jsr compare ; AND T00,S0B,$09 ==
!byte $D0,$EF,$EA,$BD,$8C,$C0,$10,$FB
!byte $C9
bcs .exit
ldx #$90
jsr compare ; AND T00,S0B,$90 ==
!byte $D0,$F4,$EA,$BD,$8C,$C0,$10,$FB
!byte $C9
bcs .exit
ldx #$9A
jsr compare ; AND T00,S0B,$9A ==
!byte $D0,$F2,$EA,$BD,$8C,$C0,$10,$FB
!byte $C9
ldx #$13
iny
jsr compare ; AND T00,S0B,$13 ==
!byte $D0,$E5,$A0,$03,$BD,$8C,$C0,$10
!byte $FB,$C9
bcs .exit
.exit
rts ; passport-test-suite/Coordinate Math v1.0.woz [C=0] matches
foundmecc1
;
; We found a MECC bootloader. Now we create
; an RWTS that can read the rest of the disk.
; Starting with our built-in RWTS, we modify address
; and data prologues based on the parameters of the
; original disk.
;
lda #$00
sta modsrc
lda #$0B
clc
adc #BASEPAGE
sta modsrc+1
ldy #$08
lda (modsrc),y
lsr
sta UNIV_A1
ldy #$12
lda (modsrc),y
sta UNIV_A2
ldy #$1D
lda (modsrc),y
sta UNIV_A3
ldy #$8F
lda (modsrc),y
sta UNIV_D1
ldy #$99
lda (modsrc),y
sta UNIV_D2
ldy #$A3
lda (modsrc),y
sta UNIV_D3
jmp ADStyle
}
;-------------------------------
; IDMECC2
; identify MECC bootloader variant #2
; (labeled "M7" on original disks)
;
; in: track buffer contains all of track 0
; out: C clear if MECC "M7" bootloader was found
; C set if not found
; all other flags clobbered
; all registers clobbered
;-------------------------------
!zone {
IDMECC2
lda #$07
IDMECC4a
ldx #$7D
ldy #$06
jsr compare ; IF T00,S07,$7D ==
!byte $BD,$8C,$C0,$10,$FB,$C9
bcs .exit
ldx #$0F
jsr compare ; and T00,S07,$0F ==
!byte $BD,$8C,$C0,$10,$FB,$49
bcs .exit
ldx #$18
iny
jsr compare ; and T00,S07,$18 ==
!byte $EA,$BD,$8C,$C0,$10,$FB,$C9
bcs .exit
ldx #$84
iny
iny
jsr compare ; AND T00,S07,$84 ==
!byte $D0,$F0,$EA,$BD,$8C,$C0,$10,$FB,$C9
bcs .exit
ldx #$8E
iny
jsr compare ; and T00,S07,$8E ==
!byte $D0,$F2,$A0,$03,$BD,$8C,$C0,$10,$FB,$C9
bcs .exit
ldx #$20
jsr compare ; and T00,S07,$20 ==
!byte $D0,$F2,$A0,$56,$BD,$8C,$C0,$10,$FB,$C9
.exit
rts
foundmecc2
;
; We found a MECC bootloader. Now we create
; an RWTS that can read the rest of the disk.
; Starting with our built-in RWTS, we modify address
; and data prologues based on the parameters of the
; original disk.
;
lda #$07
foundmecc4a
clc
adc #BASEPAGE ; passport-test-suite/Clock Works v1.0.woz [C=0] reaches here
sta modsrc+1
lda #$00
sta modsrc
ldy #$83
lda (modsrc),y
lsr
sta UNIV_A1
ldy #$8D
lda (modsrc),y
sta UNIV_A2
ldy #$98
lda (modsrc),y
sta UNIV_A3
ldy #$15
lda (modsrc),y
sta UNIV_D1
ldy #$1F
lda (modsrc),y
sta UNIV_D2
ldy #$2A
lda (modsrc),y
sta UNIV_D3
jmp ADStyle
}
;-------------------------------
; IDMECC3
; identify MECC bootloader (M7 variant
; found in Word Muncher v1.1 and others)
;
; in: track buffer contains all of track 0
; out: C clear if this MECC bootloader variant was found
; C set if not found
; all other flags clobbered
; all registers clobbered
;-------------------------------
!zone {
IDMECC3
lda #$0A
ldx #$E2
ldy #$06
jsr compare ; IF T00,S0A,$E2 ==
!byte $BD,$8C,$C0,$10,$FB,$C9
bcs .exit
ldx #$E9
ldy #$09
jsr compare ; AND T00,S0A,$E9 ==
!byte $D0,$EF,$EA,$BD,$8C,$C0,$10,$FB,$C9
bcs .exit
ldx #$F3
iny
jsr compare ; and T00,S0A,$F3 ==
!byte $D0,$F2,$A0,$03,$BD,$8C,$C0,$10,$FB,$C9
bcs .exit
lda #$0B
ldx #$69
ldy #$06
jsr compare ; and T00,S0B,$69 ==
!byte $BD,$8C,$C0,$10,$FB,$C9
bcs .exit
ldx #$70
ldy #$09
jsr compare ; and T00,S0B,$70 ==
!byte $D0,$F4,$EA,$BD,$8C,$C0,$10,$FB,$C9
bcs .exit
ldx #$7A
jsr compare ; and T00,S0B,$7A ==
!byte $D0,$F2,$EA,$BD,$8C,$C0,$10,$FB,$C9
.exit
rts ; passport-test-suite/Number Munchers v1.0.woz [C=0] matches
foundmecc3
;
; We found a MECC bootloader. Now we create
; an RWTS that can read the rest of the disk.
; Starting with our built-in RWTS, we modify address
; and data prologues based on the parameters of the
; original disk.
;
lda #$00
sta modsrc
lda #$0A
clc
adc #BASEPAGE
sta modsrc+1
ldy #$E8
lda (modsrc),y
lsr
sta UNIV_A1
ldy #$F2
lda (modsrc),y
sta UNIV_A2
ldy #$FD
lda (modsrc),y
sta UNIV_A3
inc modsrc+1
ldy #$6F
lda (modsrc),y
sta UNIV_D1
ldy #$79
lda (modsrc),y
sta UNIV_D2
ldy #$83
lda (modsrc),y
sta UNIV_D3
jmp ADStyle
}
;-------------------------------
; IDMECC4
; identify MECC bootloader variant #4
; (labeled "M8" on original disks)
; same as variant #2 but everything is
; on T00,S08 instead of T00,S07
;
; in: track buffer contains all of track 0
; out: C clear if MECC bootloader was found
; C set if not found
; all other flags clobbered
; all registers clobbered
;-------------------------------
!zone {
IDMECC4
lda #$08
jmp IDMECC4a
foundmecc4
;
; We found a MECC bootloader. Now we create
; an RWTS that can read the rest of the disk.
; Starting with our built-in RWTS, we modify address
; and data prologues based on the parameters of the
; original disk.
;
lda #$08
jmp foundmecc4a ; passport-test-suite/Conquering Whole Numbers v1.1.woz [Z=0] reaches here
}