diff --git a/src/id/precheck.a b/src/id/precheck.a new file mode 100644 index 0000000..f7be3a6 --- /dev/null +++ b/src/id/precheck.a @@ -0,0 +1,42 @@ +;------------------------------- +; PreCheckT00 +; +; Before we trace through the drive firmware (which -- +; at least on some machines -- will loop forever looking +; for each sector), we do a pre-check to ensure that all +; the sectors we're about to trace are actually readable. +; +; Before calling this function, you need to set all 16 +; bytes of the precheck_sectors array to a positive +; number (check that sector) or a negative number (don't +; check that sector). The array is ordered by logical +; sectors, regardless of the type of disk. +; +; If all required sectors are readable by Passport's own +; sector read routine, this exits gracefully with all +; flags and registered clobbered. +; +; If any required sector fails to read, this exits via +; FatalError, which does not return. +;------------------------------- +PreCheckT00 + lda #$00 + sta gTrack + ldy #$00 +@precheck_loop + lda precheck_sectors,y + bmi + + sta gSector + jsr IgnoreAddressChecksum + tya + pha + jsr ReadSector + pla + tay + bcc + + jmp FatalError ++ + iny + cpy #$10 + bne @precheck_loop + rts diff --git a/src/id/trace33.a b/src/id/trace33.a index 8622849..780c74b 100755 --- a/src/id/trace33.a +++ b/src/id/trace33.a @@ -5,31 +5,7 @@ ;------------------------------- !zone { TraceDOS33 -; -; Before we trace through the drive firmware (which -- -; at least on some machines -- will loop forever looking -; for each sector), we do a pre-check to ensure that all -; the sectors we're about to trace are actually readable. -; - lda #$00 - sta gTrack - ldy #$00 -@precheck_loop - lda precheck_sectors,y - bmi + - sta gSector - jsr IgnoreAddressChecksum - tya - pha - jsr ReadSector - pla - tay - bcc + - jmp FatalError -+ - iny - cpy #$10 - bne @precheck_loop + jsr PreCheckT00 ; ; pre-check passed, do the trace ; diff --git a/src/id/trace33p.a b/src/id/trace33p.a index e6b24c1..d0de372 100755 --- a/src/id/trace33p.a +++ b/src/id/trace33p.a @@ -32,6 +32,15 @@ IDSpecDel ; format on tracks 0-2) ;------------------------------- TraceSpecDel + ldx #$0F + lda #$FF +- sta precheck_sectors, x + dex + bpl - + inc precheck_sectors + inc precheck_sectors+7 + jsr PreCheckT00 + jsr ClearTSBuffer lda #$00 ; set a marker to see if entire sta $3FFF ; RWTS loads successfully later diff --git a/src/passport.a b/src/passport.a index 0d2cb93..49a865c 100755 --- a/src/passport.a +++ b/src/passport.a @@ -114,6 +114,7 @@ FirstMover !source "analyze.a" !source "id/inspect0.a" + !source "id/precheck.a" !source "id/trace.a" !source "id/trace33.a" !source "id/trace32.a"