fix the hybrid corner-case

seeing 13 D5 AA B5 in a row, and then the D5 AA 96
This commit is contained in:
Peter Ferrie 2019-03-13 16:57:08 -07:00
parent 3e6d9c41db
commit 3ffcfeb672

View File

@ -5,37 +5,34 @@ IDBoot
; try to determine sector type based on found boot sector ; try to determine sector type based on found boot sector
lda #$60 lda #$60
sta $867B sta $867B
jsr $8600 @patch
jsr $8600 ;SMC
ldy #$5C
sty @patch+1
bcc + bcc +
-- lda #$90 lda #$90
sta $867B sta $867B
; found D5 AA 96 T00S00 D5 AA AD, proceed as 16-sector ; found D5 AA 96 T00S00 D5 AA AD, proceed as 16-sector
- jmp $865C bne @patch ;always
@retries
!byte 14 ;sectors per track+1 to cover the corner-case
; found D5 AA not-96 ; found D5 AA not-96
; check for out-of-order D5 AA AD ; check for out-of-order D5 AA AD, and retry in that case
+ cmp #$AD + cmp #$AD
beq -- beq @patch
; otherwise, loop in case we will see D5 AA B5 ; otherwise, loop in case we will see D5 AA B5
cmp #$B5 cmp #$B5
bne - bne @patch
; found D5 AA B5, try to read address field ; and loop anyway in case it's a hybrid disk and we missed the D5 AA 96
lda #$60 dec @retries
sta $8699 bne @patch
ldy #3
jsr $868F
lda #$28
sta $8699
; non-zero track suggests copy-protection ; found nothing but D5 AA B5, proceed as 13-sector
; proceed as 16-sector instead
lda $40
bne --
; found D5 AA B5, assume 13-sector
lda #$90 lda #$90
sta $867B sta $867B