fdctrl_start/stop_transfer() used to set FD_SR0_SEEK no matter if there actually was a seek or not. This is obviously wrong.
fdctrl_seek_to_next_sect() has this information because it performs the seek itself. Cc: Kevin Wolf <kw...@redhat.com> Signed-off-by: Hervé Poussineau <hpous...@reactos.org> --- hw/fdc.c | 13 +++++++++---- tests/fdc-test.c | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/hw/fdc.c b/hw/fdc.c index d8bffb6..3c343b1 100644 --- a/hw/fdc.c +++ b/hw/fdc.c @@ -1123,11 +1123,13 @@ static int fdctrl_seek_to_next_sect(FDCtrl *fdctrl, FDrive *cur_drv) } else { new_head = 0; new_track++; + fdctrl->status0 |= FD_SR0_SEEK; if ((cur_drv->flags & FDISK_DBL_SIDES) == 0) { ret = 0; } } } else { + fdctrl->status0 |= FD_SR0_SEEK; new_track++; ret = 0; } @@ -1147,10 +1149,14 @@ static void fdctrl_stop_transfer(FDCtrl *fdctrl, uint8_t status0, uint8_t status1, uint8_t status2) { FDrive *cur_drv; - cur_drv = get_cur_drv(fdctrl); - fdctrl->status0 = status0 | FD_SR0_SEEK | (cur_drv->head << 2) | - GET_CUR_DRV(fdctrl); + + fdctrl->status0 &= ~(FD_SR0_DS0 | FD_SR0_DS1 | FD_SR0_HEAD); + fdctrl->status0 |= GET_CUR_DRV(fdctrl); + if (cur_drv->head) { + fdctrl->status0 |= FD_SR0_HEAD; + } + fdctrl->status0 |= status0; FLOPPY_DPRINTF("transfer status: %02x %02x %02x (%02x)\n", status0, status1, status2, fdctrl->status0); @@ -1284,7 +1290,6 @@ static void fdctrl_start_transfer(FDCtrl *fdctrl, int direction) if (direction != FD_DIR_WRITE) fdctrl->msr |= FD_MSR_DIO; /* IO based transfer: calculate len */ - fdctrl->status0 |= FD_SR0_SEEK; fdctrl_raise_irq(fdctrl); } diff --git a/tests/fdc-test.c b/tests/fdc-test.c index 18051ef..b825959 100644 --- a/tests/fdc-test.c +++ b/tests/fdc-test.c @@ -153,7 +153,7 @@ static uint8_t send_read_command(void) } st0 = floppy_recv(); - if (st0 != 0x60) { + if (st0 != 0x40) { ret = 1; } -- 1.7.10.4