]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
Return random data if disk DMA started with selected drive but motor turned off.
authorToni Wilen <twilen@winuae.net>
Sun, 11 Oct 2020 17:17:55 +0000 (20:17 +0300)
committerToni Wilen <twilen@winuae.net>
Sun, 11 Oct 2020 17:17:55 +0000 (20:17 +0300)
disk.cpp

index 3b31b695318fac4301112958006e21b11d73a01f..cd7a517aa855fc38f07f44cc6544fd0918140a10 100644 (file)
--- a/disk.cpp
+++ b/disk.cpp
@@ -3633,21 +3633,6 @@ static int doreaddma (void)
        return 0;
 }
 
-static void disk_doupdate_read_nothing(int floppybits)
-{
-       while (floppybits >= get_floppy_speed ()) {
-               word <<= 1;
-               doreaddma ();
-               if ((bitoffset & 7) == 7) {
-                       dskbytr_val = word & 0xff;
-                       dskbytr_val |= 0x8000;
-               }
-               bitoffset++;
-               bitoffset &= 15;
-               floppybits -= get_floppy_speed ();
-       }
-}
-
 static void wordsync_detected(bool startup)
 {
        dsksync_cycles = get_cycles() + WORDSYNC_TIME * CYCLE_UNIT;
@@ -3674,6 +3659,37 @@ static void wordsync_detected(bool startup)
        }
 }
 
+static void disk_doupdate_read_nothing(int floppybits)
+{
+       while (floppybits >= get_floppy_speed()) {
+               bool skipbit = false;
+               word <<= 1;
+               word |= (uaerand() & 0x1000) ? 1 : 0;
+               doreaddma();
+               // MSBSYNC
+               if (adkcon & 0x200) {
+                       if ((word & 0x0001) == 0 && bitoffset == 0) {
+                               word = 0;
+                               skipbit = true;
+                       }
+                       if ((word & 0x0001) == 0 && bitoffset == 8) {
+                               word >>= 1;
+                               skipbit = true;
+                       }
+               }
+               if (!skipbit && (bitoffset & 7) == 7) {
+                       dskbytr_val = word & 0xff;
+                       dskbytr_val |= 0x8000;
+               }
+               if (!(adkcon & 0x200) && word == dsksync) {
+                       wordsync_detected(false);
+               }
+               bitoffset++;
+               bitoffset &= 15;
+               floppybits -= get_floppy_speed();
+       }
+}
+
 static void disk_doupdate_read (drive * drv, int floppybits)
 {
        /*