From 3e6d9c41db81355d1a99d8a225cf9461a80ca1cf Mon Sep 17 00:00:00 2001 From: Peter Ferrie Date: Wed, 13 Mar 2019 16:23:54 -0700 Subject: [PATCH 1/2] distinguish better between 13- and hybrid-boot --- src/idboot.a | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/idboot.a b/src/idboot.a index e2b22f4..bb59357 100644 --- a/src/idboot.a +++ b/src/idboot.a @@ -11,8 +11,7 @@ IDBoot sta $867B ; found D5 AA 96 T00S00 D5 AA AD, proceed as 16-sector -- clc - jmp $865D +- jmp $865C ; found D5 AA not-96 ; check for out-of-order D5 AA AD @@ -23,6 +22,19 @@ IDBoot cmp #$B5 bne - +; found D5 AA B5, try to read address field + lda #$60 + sta $8699 + ldy #3 + jsr $868F + lda #$28 + sta $8699 + +; non-zero track suggests copy-protection +; proceed as 16-sector instead + lda $40 + bne -- + ; found D5 AA B5, assume 13-sector lda #$90 sta $867B From 3ffcfeb6721c89bb8741716be71bd56ce45e3913 Mon Sep 17 00:00:00 2001 From: Peter Ferrie Date: Wed, 13 Mar 2019 16:57:08 -0700 Subject: [PATCH 2/2] fix the hybrid corner-case seeing 13 D5 AA B5 in a row, and then the D5 AA 96 --- src/idboot.a | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/src/idboot.a b/src/idboot.a index bb59357..49c1479 100644 --- a/src/idboot.a +++ b/src/idboot.a @@ -5,37 +5,34 @@ IDBoot ; try to determine sector type based on found boot sector lda #$60 sta $867B - jsr $8600 +@patch + jsr $8600 ;SMC + ldy #$5C + sty @patch+1 bcc + --- lda #$90 + lda #$90 sta $867B ; 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 -; check for out-of-order D5 AA AD +; check for out-of-order D5 AA AD, and retry in that case + cmp #$AD - beq -- + beq @patch ; otherwise, loop in case we will see D5 AA B5 cmp #$B5 - bne - + bne @patch -; found D5 AA B5, try to read address field - lda #$60 - sta $8699 - ldy #3 - jsr $868F - lda #$28 - sta $8699 +; and loop anyway in case it's a hybrid disk and we missed the D5 AA 96 + dec @retries + bne @patch -; non-zero track suggests copy-protection -; proceed as 16-sector instead - lda $40 - bne -- - -; found D5 AA B5, assume 13-sector +; found nothing but D5 AA B5, proceed as 13-sector lda #$90 sta $867B