From c694dddf02fd2e0b41acdfc7b1ab59539b7a833e Mon Sep 17 00:00:00 2001 From: Michael Zapf Date: Mon, 6 Aug 2018 00:09:16 +0200 Subject: upd765: Fixes fifo mess-up on unexpected fifo pushes on hx5102. --- src/devices/machine/upd765.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/devices/machine/upd765.cpp b/src/devices/machine/upd765.cpp index d753859ede7..8d324ea91a7 100644 --- a/src/devices/machine/upd765.cpp +++ b/src/devices/machine/upd765.cpp @@ -584,6 +584,15 @@ void upd765_family_device::disable_transfer() void upd765_family_device::fifo_push(uint8_t data, bool internal) { + // MZ: A bit speculative. These lines help to avoid some FIFO mess-up + // with the HX5102 that happens when WRITE DATA fails to find the sector + // but the host already starts pushing the sector data. Should not hurt. + if (fifo_expected == 0) + { + LOGFIFO("Fifo not expecting data, discarding\n"); + return; + } + if(fifo_pos == 16) { if(internal) { if(!(st1 & ST1_OR)) -- cgit v1.2.3