uint8_t *driveptr = fd_tab + minor;
uint8_t cmd[7];
- if(rawflag)
- goto bad2;
-
fd_motor_busy(); /* Touch the motor timer first so we don't
go and turn it off as we are doing this */
if (fd_selected != minor) {
dptr = (uint16_t)udata.u_base;
block = udata.u_offset >> 9;
nblock = udata.u_count >> 8;
- }
+ } else
+ goto bad2;
// kprintf("Issue command: drive %d\n", minor);
cmd[0] = rawflag;
while (nblock) {
for (tries = 0; tries < 4 ; tries++) {
- kprintf("fd sector %d track %d\n", cmd[3], cmd[2]);
err = fd_operation(cmd, driveptr);
if (err == 0)
break;
- kprintf("fd error %d\n", err);
- if (tries > 1) {
- kputs("fd reset\n");
+ if (tries > 1)
fd_reset(driveptr);
- }
}
/* FIXME: should we try the other half and then bale out ? */
if (tries == 4)
nblock--;
}
fd_motor_idle();
- return 1;
+ return 0;
bad:
kprintf("fd%d: error %x\n", minor, err);
bad2:
;
beq fdiosetup
+ lda TRACK,x
sta <FDCDATA ; target
;
; So we can verify
sty nmivector ; so our NMI handler will clean up
ldy #0 ; timeout handling
orcc #0x50 ; irqs off or we'll miss bytes
+ ldb DIRECT,x
+ cmpb #0x01 ; read ?
+ beq fdio_in_1
+ cmpb #0x02
+ beq wait_drq_1 ; write
sta <FDCREG ; issue the command
nop ; give the FDC a moment to think
exg a,a
exg a,a
- ldb DIRECT,x
- cmpb #0x01 ; read ?
- beq fdio_in
- cmpb #0x02
- beq wait_drq ; write
;
; Status registers
;
;
; Relies on B being 2...
;
+wait_drq_1:
+ sta <FDCREG ; issue the command
+ nop ; give the FDC a moment to think
+ exg a,a
+ exg a,a
wait_drq:
bitb <FDCREG
bne drq_on
;
; Read from the disk
;
+fdio_in_1:
+ sta <FDCREG ; issue the command
+ nop ; give the FDC a moment to think
+ exg a,a
+ exg a,a
fdio_in:
ldx DATA,x
fdio_dwait:
.byte 0
.byte 0
_fd_tab:
- .byte 0,0,0,0
+ .byte 0xFF,0xFF,0xFF,0xFF