From 272ec75ca6182ab01dc777f6a1e92ee31f4506c7 Mon Sep 17 00:00:00 2001 From: cracyc Date: Sat, 19 Oct 2024 21:37:18 -0500 Subject: [PATCH] upd765: reset st0 when starting a seek and fail if drive isn't ready --- src/devices/machine/upd765.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/devices/machine/upd765.cpp b/src/devices/machine/upd765.cpp index fd087ec7d68..faca1ef449d 100644 --- a/src/devices/machine/upd765.cpp +++ b/src/devices/machine/upd765.cpp @@ -1615,7 +1615,13 @@ void upd765_family_device::recalibrate_start(floppy_info &fi) fi.dir = 1; fi.counter = recalibrate_steps; fi.ready = get_ready(command[1] & 3); - fi.st0 = (fi.ready ? 0 : ST0_NR); + fi.st0 = command[1] & 7; + if(!fi.ready) + { + fi.st0 |= ST0_NR | ST0_FAIL; + command_end(fi, false); + return; + } seek_continue(fi); } @@ -1626,7 +1632,13 @@ void upd765_family_device::seek_start(floppy_info &fi) fi.sub_state = SEEK_WAIT_STEP_TIME_DONE; fi.dir = fi.pcn > command[2] ? 1 : 0; fi.ready = get_ready(command[1] & 3); - fi.st0 = (fi.ready ? 0 : ST0_NR); + fi.st0 = command[1] & 7; + if(!fi.ready) + { + fi.st0 |= ST0_NR | ST0_FAIL; + command_end(fi, false); + return; + } seek_continue(fi); }