08.142: Booting from Floppy... 08.142: enter handle_13: 08.143: a=00000201 b=00000000 c=00000001 d=00000000 ds=0000 es=07c0 ss=df80 08.142: si=00000000 di=00000000 bp=00000000 sp=0000f9b0 cs=f000 ip=cbdf f=0202 08.143: disk_op d=0x000f55a0 lba=0 buf=0x00007c00 count=1 cmd=2 08.143: Floppy_drive_recal 0 08.143: Floppy_enable_controller 08.146: handle_0e 08.145: handle_0e 08.530: handle_0e 08.530: Floppy send specify 4f 10 08.530: Floppy_media_sense on drive 0 found rate 0 08.722: handle_0e 08.722: Booting from 0000:7c00 08.722: enter handle_13: 08.722: a=00000201 b=00000700 c=00000002 d=00000100 ds=0000 es=0000 ss=df80 08.723: si=00007bd2 di=00000700 bp=00007c00 sp=0000f9b0 cs=0000 ip=7d6e f=0002 08.722: disk_op d=0x000f55a0 lba=19 buf=0x00000700 count=1 cmd=2 08.915: handle_0e 08.915: enter handle_13: 08.915: a=00000201 b=00000700 c=00000010 d=00000100 ds=0000 es=0000 ss=df80 08.915: si=00007bd2 di=00000002 bp=00007c00 sp=0000f9b0 cs=0000 ip=7d6e f=0002 08.916: disk_op d=0x000f55a0 lba=33 buf=0x00000700 count=1 cmd=2 09.045: handle_0e 09.045: enter handle_13: 09.045: a=00000201 b=00000900 c=00000011 d=00000100 ds=0000 es=0000 ss=df80 09.046: si=00007bd2 di=00000002 bp=00007c00 sp=0000f9b0 cs=0000 ip=7d6e f=0006 09.046: disk_op d=0x000f55a0 lba=34 buf=0x00000900 count=1 cmd=2 09.240: handle_0e 09.240: enter handle_13: 09.240: a=00000201 b=00000b00 c=00000012 d=00000100 ds=0000 es=0000 ss=df80 09.240: si=00007bd2 di=00000002 bp=00007c00 sp=0000f9b0 cs=0000 ip=7d6e f=0006 09.240: disk_op d=0x000f55a0 lba=35 buf=0x00000b00 count=1 cmd=2 09.428: handle_0e 09.428: enter handle_13: 09.428: a=00000201 b=00000d00 c=00000101 d=00000000 ds=0000 es=0000 ss=df80 09.428: si=00007bd2 di=00000002 bp=00007c00 sp=0000f9b0 cs=0000 ip=7d6e f=0002 09.428: disk_op d=0x000f55a0 lba=36 buf=0x00000d00 count=1 cmd=2 09.810: handle_0e 09.810: floppy error: 40 04 10 01 00 01 02 09.810: invalid basic_access:96: 09.810: a=00000200 b=00000d00 c=00000101 d=00000000 ds=0000 es=0000 ss=df80 09.810: si=00007bd2 di=00000002 bp=00007c00 sp=0000f9b0 cs=0000 ip=7d6e f=0002
On Sun, Dec 08, 2013 at 06:13:52PM +0100, Gelip wrote:
08.142: Booting from Floppy...
Can you try pulling down the latest code from my github testing banch and apply the patch below? (I think real hardware may require an explicit seek command when reading different cylinders.)
-Kevin
diff --git a/src/hw/floppy.c b/src/hw/floppy.c index 48958e6..84e59b6 100644 --- a/src/hw/floppy.c +++ b/src/hw/floppy.c @@ -320,6 +320,32 @@ floppy_select_drive(u8 floppyid) return DISK_RET_SUCCESS; }
+static int +floppy_seek(u8 floppyid, u8 cyl) +{ + dprintf(1, "Floppy seek %d to cyl %d\n", floppyid, cyl); + struct floppy_pio_s pio; + pio.cmdlen = 3; + pio.resplen = 0; + pio.waitirq = 1; + pio.data[0] = 0x0f; // 0f: Seek + pio.data[1] = floppyid; + pio.data[2] = cyl; + int ret = floppy_pio(&pio); + if (ret) + return ret; + + pio.cmdlen = 1; + pio.resplen = 2; + pio.waitirq = 0; + pio.data[0] = 0x08; // 08: Check Interrupt Status + ret = floppy_pio(&pio); + if (ret) + return ret; + + return DISK_RET_SUCCESS; +} +
/**************************************************************** * Floppy media sense @@ -464,6 +490,19 @@ floppy_cmd(struct disk_op_s *op, int blocksize, struct floppy_pio_s *pio) if (ret) return ret;
+ // XXX - seek + u8 floppyid = pio->data[1] & 1; + if (pio->data[0] == 0xe6 || pio->data[0] == 0xc5) { + u8 curcyl = GET_BDA(floppy_track[floppyid]); + u8 reqcyl = pio->data[2]; + if (curcyl != reqcyl) { + ret = floppy_seek(floppyid, reqcyl); + if (ret) + return ret; + set_diskette_current_cyl(floppyid, reqcyl); + } + } + // Setup DMA controller int isWrite = pio->data[0] != 0xe6; ret = dma_floppy((u32)op->buf_fl, op->count * blocksize, isWrite); @@ -471,7 +510,7 @@ floppy_cmd(struct disk_op_s *op, int blocksize, struct floppy_pio_s *pio) return DISK_RET_EBOUNDARY;
// Invoke floppy controller - ret = floppy_select_drive(pio->data[1] & 1); + ret = floppy_select_drive(floppyid); if (ret) return ret; pio->resplen = 7; @@ -495,7 +534,7 @@ floppy_cmd(struct disk_op_s *op, int blocksize, struct floppy_pio_s *pio) }
u8 track = (pio->cmdlen == 9 ? pio->data[3] : 0); - set_diskette_current_cyl(pio->data[0] & 1, track); + set_diskette_current_cyl(floppyid, track);
return DISK_RET_SUCCESS; }