From: Toni Wilen Date: Mon, 2 Jan 2023 18:54:07 +0000 (+0200) Subject: Update DSKBYTR only when data is available, remove unneeded dsksync hacks. X-Git-Tag: 41010~29 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=e076baebb5325840f29f2a8c1e4722389b4b5c13;p=francis%2Fwinuae.git Update DSKBYTR only when data is available, remove unneeded dsksync hacks. --- diff --git a/disk.cpp b/disk.cpp index 87cb9861..baaa83e8 100644 --- a/disk.cpp +++ b/disk.cpp @@ -128,8 +128,6 @@ static int fifo_inuse[3]; static int dma_enable, bitoffset, syncoffset; static uae_u16 word, dsksync; static bool dsksync_on; -static evt_t dsksync_cycles; -#define WORDSYNC_TIME 11 /* Always carried through to the next line. */ int disk_hpos; static int disk_jitter; @@ -4104,7 +4102,6 @@ static int doreaddma (void) static void wordsync_detected(bool startup) { - dsksync_cycles = get_cycles() + WORDSYNC_TIME * CYCLE_UNIT; if (dskdmaen != DSKDMA_OFF) { if (disk_debug_logging && dma_enable == 0) { int pos = -1; @@ -4131,6 +4128,11 @@ static void wordsync_detected(bool startup) } } +static bool canloaddskbytr(void) +{ + return (bitoffset & 7) == 7 && (word & 0xff) != 0x00 && (word & 0xff) != 0xff; +} + static void disk_doupdate_read_reallynothing(int floppybits, bool state) { while (floppybits >= get_floppy_speed()) { @@ -4150,7 +4152,7 @@ static void disk_doupdate_read_reallynothing(int floppybits, bool state) skipbit = true; } } - if (!skipbit && (bitoffset & 7) == 7 && !waszero) { + if (!skipbit && canloaddskbytr()) { dskbytr_val = word & 0xff; dskbytr_val |= 0x8000; } @@ -4185,7 +4187,7 @@ static void disk_doupdate_read_nothing(int floppybits) skipbit = true; } } - if (!skipbit && (bitoffset & 7) == 7) { + if (!skipbit && canloaddskbytr()) { dskbytr_val = word & 0xff; dskbytr_val |= 0x8000; } @@ -4289,7 +4291,7 @@ static void disk_doupdate_read (drive * drv, int floppybits) } } - if (!skipbit && (bitoffset & 7) == 7) { + if (!skipbit && canloaddskbytr()) { dskbytr_val = word & 0xff; dskbytr_val |= 0x8000; } @@ -4326,7 +4328,7 @@ uae_u16 DSKBYTR(int hpos) DISK_update(hpos); v = dskbytr_val; dskbytr_val &= ~0x8000; - if (word == dsksync && cycles_in_range(dsksync_cycles)) { + if (word == dsksync) { v |= 0x1000; if (disk_debug_logging > 1) { dumpdisk(_T("DSKBYTR SYNC"));