diff --git a/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Machine/SpectrumBase.cs b/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Machine/SpectrumBase.cs index 43c0ec8b7a..11ec6ae96b 100644 --- a/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Machine/SpectrumBase.cs +++ b/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Machine/SpectrumBase.cs @@ -123,7 +123,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum PollInput(); - while (CurrentFrameCycle <= ULADevice.FrameLength) // UlaFrameCycleCount) + while (CurrentFrameCycle < ULADevice.FrameLength) // UlaFrameCycleCount) { // check for interrupt ULADevice.CheckForInterrupt(CurrentFrameCycle); diff --git a/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Machine/ULABase.cs b/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Machine/ULABase.cs index d6e3b1ef66..1604006525 100644 --- a/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Machine/ULABase.cs +++ b/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Machine/ULABase.cs @@ -254,7 +254,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum /// /// The longest instruction cycle count /// - protected const int LONGEST_OP_CYCLES = 23; + protected int LongestOperationCycles = 23; /// /// Signs that an interrupt has been raised in this frame. @@ -288,19 +288,19 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum return; } - if (currentCycle < InterruptPeriod) + if (currentCycle < LongestOperationCycles)// InterruptPeriod) { // interrupt does not need to be raised yet return; } - if (currentCycle > InterruptPeriod + LONGEST_OP_CYCLES) + if (currentCycle >= InterruptPeriod + LongestOperationCycles) { // interrupt should have already been raised and the cpu may or // may not have caught it. The time has passed so revoke the signal InterruptRevoked = true; _machine.CPU.FlagI = false; - + return; } if (InterruptRaised) diff --git a/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Machine/ZXSpectrum128K/ZX128.ULA.cs b/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Machine/ZXSpectrum128K/ZX128.ULA.cs index d7cc8f4941..92789fa82c 100644 --- a/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Machine/ZXSpectrum128K/ZX128.ULA.cs +++ b/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Machine/ZXSpectrum128K/ZX128.ULA.cs @@ -9,6 +9,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum : base(machine) { InterruptPeriod = 36; + LongestOperationCycles = 23; FrameLength = 70908; ClockSpeed = 3546900; diff --git a/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Machine/ZXSpectrum48K/ZX48.ULA.cs b/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Machine/ZXSpectrum48K/ZX48.ULA.cs index a093a33aad..f72bc8bde1 100644 --- a/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Machine/ZXSpectrum48K/ZX48.ULA.cs +++ b/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Machine/ZXSpectrum48K/ZX48.ULA.cs @@ -9,6 +9,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum : base(machine) { InterruptPeriod = 32; + LongestOperationCycles = 23; FrameLength = 69888; ClockSpeed = 3500000;