ZXHawk: Fix memory contention lookup overflow

This commit is contained in:
Asnivor 2018-06-04 17:11:12 +01:00
parent bff3f41c9a
commit 7dfd19de2b
2 changed files with 6 additions and 2 deletions

View File

@ -109,7 +109,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
}
if (_machine.IsContended(addr))
_cpu.TotalExecutedCycles += _machine.ULADevice.GetContentionValue();
_cpu.TotalExecutedCycles += _machine.ULADevice.GetContentionValue((int)(_machine.CurrentFrameCycle + 1));
}
}

View File

@ -752,7 +752,11 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
/// <returns></returns>
public int GetContentionValue()
{
return RenderingTable.Renderer[_machine.CurrentFrameCycle].ContentionValue;
var f = _machine.CurrentFrameCycle;
if (f >= FrameCycleLength)
f -= FrameCycleLength;
return RenderingTable.Renderer[f].ContentionValue;
}
/// <summary>