Some floating bus work (although still not working)

This commit is contained in:
Asnivor 2017-12-11 18:00:59 +00:00
parent 2759f65b1a
commit 3d508455ec
2 changed files with 26 additions and 4 deletions

View File

@ -69,11 +69,11 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
/// <summary>
/// T-State at which to start applying contention
/// </summary>
protected int contentionStartPeriod;
public int contentionStartPeriod;
/// <summary>
/// T-State at which to end applying contention
/// </summary>
protected int contentionEndPeriod;
public int contentionEndPeriod;
/// <summary>
/// T-State memory contention delay mapping
/// </summary>
@ -102,7 +102,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
/// <summary>
/// Table that stores T-State to screen/attribute address values
/// </summary>
protected short[] floatingBusTable;
public short[] floatingBusTable;
/// <summary>
/// Cycle at which the last render update took place
/// </summary>

View File

@ -30,6 +30,8 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
}
else if (lowBitReset)
{
CPU.TotalExecutedCycles += ULADevice.contentionTable[CurrentFrameCycle];
// Even I/O address so get input
// The high byte indicates which half-row of keys is being polled
/*
@ -115,7 +117,27 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
// Kemptson Mouse
// if unused port the floating memory bus should be returned (still todo)
// if unused port the floating memory bus should be returned
// Floating bus is read on the previous cycle
int _tStates = CurrentFrameCycle - 1;
// if we are on the top or bottom border return 0xff
if ((_tStates < ULADevice.contentionStartPeriod) || (_tStates > ULADevice.contentionEndPeriod))
{
result = 0xff;
}
else
{
if (ULADevice.floatingBusTable[_tStates] < 0)
{
result = 0xff;
}
else
{
result = ReadBus((ushort)ULADevice.floatingBusTable[_tStates]);
}
}
}
return (byte)result;