refactor PreCheckT00 and call it before tracing DOS 3.3P

This commit is contained in:
4am 2021-04-12 17:32:38 -04:00
parent cc6f10d749
commit 0bf69eacb2
4 changed files with 53 additions and 25 deletions

42
src/id/precheck.a Normal file
View File

@ -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

View File

@ -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
;

View File

@ -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

View File

@ -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"