From a1df2a4751117d273c7030b6db042992a5a3bd41 Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Fri, 23 Sep 2022 20:34:52 +0300 Subject: [PATCH] Fix disk read handling when attempting to read from non-selected drive. --- disk.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/disk.cpp b/disk.cpp index 0ed9aca7..8cf0caf3 100644 --- a/disk.cpp +++ b/disk.cpp @@ -4471,14 +4471,18 @@ void DISK_update (int tohpos) drv->floppybitcounter %= drv->trackspeed; didaccess = 1; } - /* no floppy selected but dma active */ if (!didaccess) { - if (dskdmaen == DSKDMA_READ) { - disk_doupdate_read_nothing(cycles); - } else if (dskdmaen == DSKDMA_WRITE) { - disk_doupdate_write(cycles, get_floppy_speed()); - } else { - //disk_doupdate_read_reallynothing(cycles, true); + if ((selected | disabled) != 15) { + /* no active floppy (selected and motor active) found but DMA was active */ + if (dskdmaen == DSKDMA_READ) { + disk_doupdate_read_nothing(cycles); + } else if (dskdmaen == DSKDMA_WRITE) { + disk_doupdate_write(cycles, get_floppy_speed()); + } + } + /* no floppy selected and no DMA */ + if ((selected | disabled) == 15 && dskdmaen < DSKDMA_WRITE) { + disk_doupdate_read_reallynothing(cycles, false); } } -- 2.47.3