passport/src/id/ea.a

92 lines
2.0 KiB
Plaintext
Raw Normal View History

2017-01-30 22:10:41 +00:00
;-------------------------------
; IDEA
; identify Electronic Arts custom bootloader
;
2021-06-19 23:42:56 +00:00
; 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
2017-01-30 22:10:41 +00:00
;
; module by qkumba
;-------------------------------
2021-06-19 14:54:56 +00:00
!macro IDEA {
ldy #16
2017-01-30 22:10:41 +00:00
jsr compare
!byte $05,$4C,$04,$08,$A9,$00,$8D,$F2
!byte $03,$A9,$C6,$8D,$F3,$03,$49,$A5
2018-01-25 19:56:43 +00:00
bcc +
jsr compare
!byte $01,$A5,$27,$C9,$09,$D0,$2E,$A2
!byte $10,$8A,$9D,$EF,$03,$CA,$D0,$F9
2021-06-19 14:54:56 +00:00
+
}
2017-01-30 22:10:41 +00:00
foundea
;
; We found an EA 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.
;
!zone {
jsr PrintByID
!byte s_eab0
2017-01-30 22:10:41 +00:00
jsr CopyUniversal
; mark track $22 as "optional" in sector map
ldy #$0F
lda #kSectorOptional
2017-01-30 22:10:41 +00:00
.ignoresectors
sta T22,y
dey
bpl .ignoresectors
;hook read data prologue
lda #<.checktrk
sta $BE36
lda #>.checktrk
sta $BE37
;
; this RWTS alters the data prologue in a routine
; on a non-zero track, so we need to set a flag so
; we know to search for it later
;
lda #TRUE
sta gIsEA
jmp ADStyle
.prologtbl
!byte $AA, $BB, $AD, $CF
;try regular values first
.checktrk
ldy #0
lda .prologtbl, y
sta UNIV_D2
2017-01-30 22:10:41 +00:00
lda .prologtbl+2, y
sta UNIV_D3
2017-01-30 22:10:41 +00:00
jsr $B8DC
bcc +
;on failure, switch to alternative values
;we keep using the last successful values until we fail
;and then we switch again
lda .checktrk + 1
eor #1
sta .checktrk + 1
;and allow DOS to retry
;if DOS runs out of retries, then Passport will report it
+ rts
}