Pull in most recent poll-with-timeout from Peter.

This commit is contained in:
Martin Haye 2021-02-28 06:28:43 -08:00
commit 013c113dba

View File

@ -23,6 +23,7 @@ ver_02 = 1
aligned_read = 0 ;set to 1 if all reads can be a multiple of block size (required for RWTS mode)
enable_readseq=1 ;set to 1 to enable reading multiple sequential times from the same file without seek
;(exposes a fixed address that can be called for either floppy or hard disk support)
;requires fast_subindex
enable_write = 1 ;set to 1 to enable write support
;file must exist already and its size cannot be altered
;writes occur in multiples of block size
@ -1210,8 +1211,9 @@ foundname iny
jmp rdwrfilei
rdwrfile
!if allow_subdir = 1 {
jsr prepdrive
!if allow_subdir = 1 {
clc
} ;allow_subdir = 1
!if no_interrupts = 1 {
@ -1235,11 +1237,6 @@ unrdrvoff3 = unrelocdsk + (* - reloc)
+
} ;no_interrupts = 1
!if allow_multi = 1 {
ldy driveind + 1
} ;allow_multi = 1
jsr prepdrivei
rdwrfilei
!if (override_adr + allow_subdir + allow_saplings + allow_trees + (aligned_read xor 1)) > 0 {
;restore load offset
@ -1669,65 +1666,6 @@ unrdrvoff5 = unrelocdsk + (* - reloc)
} ;one_shot = 0
} ;aligned_read = 0
prepdrive
!if allow_multi = 1 {
ldy #0
} ;allow_multi = 1
prepdrivei
jsr poll
php
unrdrvon2 = unrelocdsk + (* - reloc)
lda MOTORON
!if allow_multi = 1 {
asl reqcmd
bcc seldrive
twodrives nop ;replace with INY if drive exists
seldrive lsr reqcmd
unrdrvsel2 = unrelocdsk + (* - reloc)
lda DRV0EN, y
cpy driveind + 1
beq nodelay
sty driveind + 1
plp
ldy #0
php
nodelay
} ;allow_multi = 1
plp
bne +
jsr spinup
+
!if poll_drive = 1 {
jsr poll
bne +
pla
pla
jmp nodisk
+
; Drive is spinning. See if there's real disk data.
ldx #0
ldy #0
-- jsr readnib
- cmp #$D5
beq +
inx
bne --
iny
bne --
pla
pla
jmp nodisk
+ jsr readnib
cmp #$AA
bne -
jsr readnib
cmp #$96
bne -
} ;poll_drive = 1
rts
;no tricks here, just the regular stuff
seek ldy #0
@ -1776,6 +1714,48 @@ unrseek = unrelocdsk + (* - reloc)
lda PHASEOFF, x
rts
prepdrive
!if allow_multi = 1 {
ldy #0
} ;allow_multi = 1
jsr poll
php
unrdrvon2 = unrelocdsk + (* - reloc)
lda MOTORON
!if allow_multi = 1 {
asl reqcmd
bcc seldrive
twodrives nop ;replace with INY if drive exists
seldrive lsr reqcmd
unrdrvsel2 = unrelocdsk + (* - reloc)
lda DRV0EN, y
driveind cpy #0
beq nodelay
sty driveind + 1
plp
ldy #0
php
nodelay
} ;allow_multi = 1
plp
!if poll_drive = 0 {
bne seekret
;else fall through to spinup
} else { ;poll_drive = 1 {
bne +
jsr spinup
+
jsr readd5aa
bcs seekret
pla
pla
jmp nodisk
} ;poll_drive = 1
spinup ldy #6
- jsr delay
dey
@ -1812,7 +1792,16 @@ readadr
seekret rts
readd5aa
-- jsr readnib
!if poll_drive = 1 {
ldx #0
ldy #0
} ;poll_drive = 1
--
!if poll_drive = 1 {
inx
beq +
} ;poll_drive = 1
--- jsr readnib
- cmp #$d5
bne --
jsr readnib
@ -1826,6 +1815,13 @@ unrread1 = unrelocdsk + (* - reloc)
bpl -
rts
!if poll_drive = 1 {
+ iny
bne ---
clc
rts
} ;poll_drive = 1
poll ldx #0
unrread2 = unrelocdsk + (* - reloc)
- lda Q6L
@ -1886,7 +1882,7 @@ seekrdwr
sta reqsec
!if allow_multi = 1 {
driveind ldy #0
ldy driveind + 1
ldx trackd1, y
} else { ;allow_multi = 0
trackd1 = * + 1