Fixed off-by-one-tstate frame timing issue
This commit is contained in:
parent
ec7445669c
commit
c8ea81bfd8
|
@ -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);
|
||||
|
|
|
@ -254,7 +254,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
|||
/// <summary>
|
||||
/// The longest instruction cycle count
|
||||
/// </summary>
|
||||
protected const int LONGEST_OP_CYCLES = 23;
|
||||
protected int LongestOperationCycles = 23;
|
||||
|
||||
/// <summary>
|
||||
/// 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)
|
||||
|
|
|
@ -9,6 +9,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
|||
: base(machine)
|
||||
{
|
||||
InterruptPeriod = 36;
|
||||
LongestOperationCycles = 23;
|
||||
FrameLength = 70908;
|
||||
ClockSpeed = 3546900;
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
|||
: base(machine)
|
||||
{
|
||||
InterruptPeriod = 32;
|
||||
LongestOperationCycles = 23;
|
||||
FrameLength = 69888;
|
||||
ClockSpeed = 3500000;
|
||||
|
||||
|
|
Loading…
Reference in New Issue