From: Toni Wilen Date: Sun, 11 Oct 2020 17:17:55 +0000 (+0300) Subject: Return random data if disk DMA started with selected drive but motor turned off. X-Git-Tag: 4900~285 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=92d5875f59c33bff46bcd74ff259a004255de559;p=francis%2Fwinuae.git Return random data if disk DMA started with selected drive but motor turned off. --- diff --git a/disk.cpp b/disk.cpp index 3b31b695..cd7a517a 100644 --- 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) { /*