From 183983043a7b68d2c899ce722e9d947057fd09b3 Mon Sep 17 00:00:00 2001 From: Asnivor Date: Tue, 19 Jun 2018 11:42:08 +0100 Subject: [PATCH] ZXHawk: Reset disk overrun detection counter on successful read (fixes IronLord.dsk) - #1158 --- .../SinclairSpectrum/Hardware/Disk/NECUPD765.FDC.cs | 2 ++ .../Hardware/Disk/NECUPD765.IPortIODevice.cs | 12 ++++++++++-- .../SinclairSpectrum/Machine/SpectrumBase.cs | 9 ++++++--- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Hardware/Disk/NECUPD765.FDC.cs b/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Hardware/Disk/NECUPD765.FDC.cs index 2e1a99a806..f3e946342d 100644 --- a/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Hardware/Disk/NECUPD765.FDC.cs +++ b/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Hardware/Disk/NECUPD765.FDC.cs @@ -2415,6 +2415,8 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum switch (ActivePhase) { case Phase.Execution: + // reset overrun counter + OverrunCounter = 0; // execute read ActiveCommand.CommandDelegate(); diff --git a/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Hardware/Disk/NECUPD765.IPortIODevice.cs b/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Hardware/Disk/NECUPD765.IPortIODevice.cs index b1ed8bce99..3c53007c0b 100644 --- a/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Hardware/Disk/NECUPD765.IPortIODevice.cs +++ b/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Hardware/Disk/NECUPD765.IPortIODevice.cs @@ -1,5 +1,6 @@ using System; using System.Collections; +using System.Collections.Generic; using System.Text; namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum @@ -23,6 +24,12 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum public string outputString = "STATUS,WRITE,READ,CODE,MT,MF,SK,CMDCNT,RESCNT,EXECCNT,EXECLEN\r\n"; public bool writeDebug = false; + public List dLog = new List + { + "STATUS,WRITE,READ,CODE,MT,MF,SK,CMDCNT,RESCNT,EXECCNT,EXECLEN" + }; + + /* * Status read * Data write @@ -56,9 +63,10 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum sb.Append(ExecCounter).Append(","); sb.Append(ExecLength); - sb.Append("\r\n"); + //sb.Append("\r\n"); - outputString += sb.ToString(); + //outputString += sb.ToString(); + dLog.Add(sb.ToString()); } #endregion diff --git a/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Machine/SpectrumBase.cs b/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Machine/SpectrumBase.cs index f2c4de0c31..75f146f2a5 100644 --- a/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Machine/SpectrumBase.cs +++ b/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Machine/SpectrumBase.cs @@ -203,9 +203,12 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum { // only write UPD log every second if (FrameCount % 10 == 0) - System.IO.File.WriteAllText(UPDDiskDevice.outputfile, UPDDiskDevice.outputString); - } - + { + System.IO.File.AppendAllLines(UPDDiskDevice.outputfile, UPDDiskDevice.dLog); + UPDDiskDevice.dLog = new System.Collections.Generic.List(); + //System.IO.File.WriteAllText(UPDDiskDevice.outputfile, UPDDiskDevice.outputString); + } + } } #endregion