in 13-sector mode, skip tracks properly and never fall back to universal RWTS

This commit is contained in:
4am 2017-08-17 15:11:19 -04:00
parent 2f7d6119e1
commit 9e3664f630

View File

@ -361,13 +361,12 @@ checksector
lda $FFFF ; current sector in sector map lda $FFFF ; current sector in sector map
pha pha
beq nextsector ; #$00 = skip this sector beq nextsector ; #$00 = skip this sector
cmp #$FE ; #$FE = switch to built-in RWTS cmp #$FE ; #$FE = switch to built-in RWTS to read this sector
bne + ; to read this sector bne +
lda gTriedUniv lda gTriedUniv
beq + beq +
jsr SwitchToUniv jsr SwitchToUniv
+ + jsr ReadSector
jsr ReadSector
bcc nextsector bcc nextsector
pla pla
pha pha
@ -379,35 +378,46 @@ checksector
cmp #$80 cmp #$80
beq .optional beq .optional
; ;
; (13-sector only)
; If we just got to this track, check for whole-track protections.
;
lda gIsDOS32
bne +
lda gSector
cmp #$0C
beq .tryskip
;
; If we're in the middle of a track, try switching to the ; If we're in the middle of a track, try switching to the
; universal RWTS and see if that helps. (Many disks contain ; universal RWTS and see if that helps. (Many disks contain
; an RWTS that can't read the early tracks or sectors that ; an RWTS that can't read the early tracks or sectors that
; contain the RWTS code, since those are loaded by the ; contain the RWTS code, since those are loaded by the
; disk controller firmware.) ; disk controller firmware.)
; ;
lda gSector + lda gSector
cmp #$0F cmp #$0F
bne .tryuniversal bne .tryuniversal
; ;
; We just got to this track, so check for a variety ; We just got to this track, so check for a variety
; of whole-track conditions that might indicate we should ; of whole-track conditions that might indicate we should
; just skip the entire track ; just skip the entire track
.tryskip
sta .sub+1
jsr SkipTrack jsr SkipTrack
bcs .tryuniversal bcs .tryuniversal
; Skip this track (we already printed the reason) ; Skip this track (we already printed the reason)
lda #$00 lda #$00
jsr ChangeSector jsr ChangeSector
lda checksector+1 lda checksector+1
sec sec
sbc #$0F .sub sbc #$0F
sta checksector+1 sta checksector+1
bcs .notrackdec bcs +
dec checksector+2 dec checksector+2
.notrackdec + jmp nextsector
jmp nextsector
.tryuniversal .tryuniversal
lda gIsDOS32 ; is this a DOS 3.2 disk?
beq .fatal ; yes, so read error is fatal
lda gTriedUniv ; have we tried the universal RWTS? lda gTriedUniv ; have we tried the universal RWTS?
beq .fatal ; yes, so read error is fatal beq .fatal ; yes, so read error is fatal
jsr SwitchToUniv ; no, switch it in now jsr SwitchToUniv ; no, switch it in now