ZXHawk: Small performance increase (rendering cycle now happens only when it needs to)
This commit is contained in:
parent
b0af0e48e0
commit
843dc7a69a
|
@ -61,8 +61,6 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
|||
/// </summary>
|
||||
public void ExecuteCycle()
|
||||
{
|
||||
_machine.ULADevice.RenderScreen((int)_machine.CurrentFrameCycle);
|
||||
|
||||
// is the next CPU cycle causing a BUSRQ or IORQ?
|
||||
if (BUSRQ > 0)
|
||||
{
|
||||
|
@ -208,7 +206,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
|||
break;
|
||||
// WZ: T3
|
||||
case Z80A.WIO3:
|
||||
lastPortAddr = AscertainBUSRQAddress();
|
||||
lastPortAddr = AscertainBUSRQAddress();
|
||||
isIO = true;
|
||||
if (IsIOCycleContended(3))
|
||||
_cpu.TotalExecutedCycles += _machine.ULADevice.GetPortContentionValue((int)_machine.CurrentFrameCycle);
|
||||
|
|
|
@ -167,7 +167,9 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
|||
while (CurrentFrameCycle < ULADevice.FrameLength)
|
||||
{
|
||||
ULADevice.CheckForInterrupt(CurrentFrameCycle);
|
||||
|
||||
CPUMon.ExecuteCycle();
|
||||
|
||||
// cycle the tape device
|
||||
if (UPDDiskDevice == null || !UPDDiskDevice.FDD_IsDiskLoaded)
|
||||
TapeDevice.TapeCycle();
|
||||
|
|
|
@ -589,10 +589,6 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
|||
// check boundaries
|
||||
if (toCycle > FrameCycleLength)
|
||||
toCycle = FrameCycleLength;
|
||||
if (LastTState > toCycle)
|
||||
LastTState = toCycle - 2;
|
||||
if (toCycle < 0)
|
||||
toCycle = 0;
|
||||
|
||||
// render the required number of cycles
|
||||
for (int t = LastTState; t < toCycle; t++)
|
||||
|
|
|
@ -134,6 +134,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
|||
|
||||
// RAM 0x4000 (RAM5 - Bank5 or shadow bank RAM7)
|
||||
case 1:
|
||||
ULADevice.RenderScreen((int)CurrentFrameCycle);
|
||||
RAM5[addr % 0x4000] = value;
|
||||
break;
|
||||
|
||||
|
@ -162,6 +163,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
|||
RAM4[addr % 0x4000] = value;
|
||||
break;
|
||||
case 5:
|
||||
ULADevice.RenderScreen((int)CurrentFrameCycle);
|
||||
RAM5[addr % 0x4000] = value;
|
||||
break;
|
||||
case 6:
|
||||
|
|
|
@ -236,9 +236,11 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
|||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
ULADevice.RenderScreen((int)CurrentFrameCycle);
|
||||
RAM5[addr % 0x4000] = value;
|
||||
break;
|
||||
case 3:
|
||||
ULADevice.RenderScreen((int)CurrentFrameCycle);
|
||||
RAM7[addr % 0x4000] = value;
|
||||
break;
|
||||
}
|
||||
|
@ -265,6 +267,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
|||
RAM3[addr % 0x4000] = value;
|
||||
break;
|
||||
case 1:
|
||||
ULADevice.RenderScreen((int)CurrentFrameCycle);
|
||||
RAM7[addr % 0x4000] = value;
|
||||
break;
|
||||
}
|
||||
|
@ -299,6 +302,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
|||
|
||||
// RAM 0x4000 (RAM5 - Bank5 only)
|
||||
case 1:
|
||||
ULADevice.RenderScreen((int)CurrentFrameCycle);
|
||||
RAM5[addr % 0x4000] = value;
|
||||
break;
|
||||
|
||||
|
@ -327,12 +331,14 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
|||
RAM4[addr % 0x4000] = value;
|
||||
break;
|
||||
case 5:
|
||||
ULADevice.RenderScreen((int)CurrentFrameCycle);
|
||||
RAM5[addr % 0x4000] = value;
|
||||
break;
|
||||
case 6:
|
||||
RAM6[addr % 0x4000] = value;
|
||||
break;
|
||||
case 7:
|
||||
ULADevice.RenderScreen((int)CurrentFrameCycle);
|
||||
RAM7[addr % 0x4000] = value;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -144,7 +144,11 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
|||
*/
|
||||
|
||||
// Border - LSB 3 bits hold the border colour
|
||||
ULADevice.BorderColor = value & BORDER_BIT;
|
||||
if (ULADevice.BorderColor != (value & BORDER_BIT))
|
||||
{
|
||||
ULADevice.RenderScreen((int)CurrentFrameCycle);
|
||||
ULADevice.BorderColor = value & BORDER_BIT;
|
||||
}
|
||||
|
||||
// Buzzer
|
||||
BuzzerDevice.ProcessPulseValue((value & EAR_BIT) != 0);
|
||||
|
|
|
@ -236,10 +236,12 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
|||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
ULADevice.RenderScreen((int)CurrentFrameCycle);
|
||||
RAM5[addr % 0x4000] = value;
|
||||
break;
|
||||
case 3:
|
||||
RAM7[addr % 0x4000] = value;
|
||||
ULADevice.RenderScreen((int)CurrentFrameCycle);
|
||||
RAM7[addr % 0x4000] = value;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
@ -265,6 +267,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
|||
RAM3[addr % 0x4000] = value;
|
||||
break;
|
||||
case 1:
|
||||
ULADevice.RenderScreen((int)CurrentFrameCycle);
|
||||
RAM7[addr % 0x4000] = value;
|
||||
break;
|
||||
}
|
||||
|
@ -299,6 +302,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
|||
|
||||
// RAM 0x4000 (RAM5 - Bank5 only)
|
||||
case 1:
|
||||
ULADevice.RenderScreen((int)CurrentFrameCycle);
|
||||
RAM5[addr % 0x4000] = value;
|
||||
break;
|
||||
|
||||
|
@ -327,12 +331,14 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
|||
RAM4[addr % 0x4000] = value;
|
||||
break;
|
||||
case 5:
|
||||
ULADevice.RenderScreen((int)CurrentFrameCycle);
|
||||
RAM5[addr % 0x4000] = value;
|
||||
break;
|
||||
case 6:
|
||||
RAM6[addr % 0x4000] = value;
|
||||
break;
|
||||
case 7:
|
||||
ULADevice.RenderScreen((int)CurrentFrameCycle);
|
||||
RAM7[addr % 0x4000] = value;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -150,7 +150,11 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
|||
*/
|
||||
|
||||
// Border - LSB 3 bits hold the border colour
|
||||
ULADevice.BorderColor = value & BORDER_BIT;
|
||||
if (ULADevice.BorderColor != (value & BORDER_BIT))
|
||||
{
|
||||
ULADevice.RenderScreen((int)CurrentFrameCycle);
|
||||
ULADevice.BorderColor = value & BORDER_BIT;
|
||||
}
|
||||
|
||||
// Buzzer
|
||||
BuzzerDevice.ProcessPulseValue((value & EAR_BIT) != 0);
|
||||
|
|
|
@ -85,6 +85,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
|||
// cannot write to ROM
|
||||
break;
|
||||
case 1:
|
||||
ULADevice.RenderScreen((int)CurrentFrameCycle);
|
||||
RAM0[index] = value;
|
||||
break;
|
||||
}
|
||||
|
@ -98,11 +99,6 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
|||
/// <returns></returns>
|
||||
public override byte ReadMemory(ushort addr)
|
||||
{
|
||||
/*
|
||||
if (IsContended(addr))
|
||||
CPU.TotalExecutedCycles += ULADevice.GetContentionValue((int)CurrentFrameCycle);
|
||||
*/
|
||||
|
||||
var data = ReadBus(addr);
|
||||
return data;
|
||||
}
|
||||
|
@ -115,15 +111,6 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
|||
/// <param name="value"></param>
|
||||
public override void WriteMemory(ushort addr, byte value)
|
||||
{
|
||||
/*
|
||||
// apply contention if necessary
|
||||
if (IsContended(addr))
|
||||
{
|
||||
ULADevice.RenderScreen((int)CurrentFrameCycle);
|
||||
CPU.TotalExecutedCycles += ULADevice.GetContentionValue((int)CurrentFrameCycle);
|
||||
}
|
||||
*/
|
||||
|
||||
WriteBus(addr, value);
|
||||
}
|
||||
|
||||
|
|
|
@ -77,10 +77,11 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
|||
// cannot write to ROM
|
||||
break;
|
||||
case 1:
|
||||
ULADevice.RenderScreen((int)CurrentFrameCycle);
|
||||
RAM0[index] = value;
|
||||
break;
|
||||
case 2:
|
||||
RAM1[index] = value;
|
||||
RAM1[index] = value;
|
||||
break;
|
||||
case 3:
|
||||
RAM2[index] = value;
|
||||
|
|
|
@ -82,8 +82,11 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
|||
*/
|
||||
|
||||
// Border - LSB 3 bits hold the border colour
|
||||
//ULADevice.RenderScreen((int)CurrentFrameCycle);
|
||||
ULADevice.BorderColor = value & BORDER_BIT;
|
||||
if (ULADevice.BorderColor != (value & BORDER_BIT))
|
||||
{
|
||||
ULADevice.RenderScreen((int)CurrentFrameCycle);
|
||||
ULADevice.BorderColor = value & BORDER_BIT;
|
||||
}
|
||||
|
||||
// Buzzer
|
||||
BuzzerDevice.ProcessPulseValue((value & EAR_BIT) != 0);
|
||||
|
|
Loading…
Reference in New Issue