commodore64: Tie AEC between Vic and Cpu, tie BA from Vic to RDY on Cpu. Results in better emulation of CPU bus shutdown
This commit is contained in:
parent
9de7ee3336
commit
557f2c8815
|
@ -155,7 +155,7 @@ namespace BizHawk.Emulation.Computers.Commodore64
|
||||||
|
|
||||||
private byte ReadMemoryCPU(ushort addr)
|
private byte ReadMemoryCPU(ushort addr)
|
||||||
{
|
{
|
||||||
if (!signal.CpuAEC)
|
if (!signal.CpuRDY || !signal.CpuAEC)
|
||||||
haltCPU = true;
|
haltCPU = true;
|
||||||
return mem.Read(addr);
|
return mem.Read(addr);
|
||||||
}
|
}
|
||||||
|
@ -164,6 +164,13 @@ namespace BizHawk.Emulation.Computers.Commodore64
|
||||||
{
|
{
|
||||||
mem.Write(addr, value);
|
mem.Write(addr, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void WriteMemoryCPU(ushort addr, byte value)
|
||||||
|
{
|
||||||
|
if (!signal.CpuAEC)
|
||||||
|
haltCPU = true;
|
||||||
|
mem.Write(addr, value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ChipSignals
|
public class ChipSignals
|
||||||
|
@ -172,6 +179,7 @@ namespace BizHawk.Emulation.Computers.Commodore64
|
||||||
private bool[] _CiaIRQOutput = new bool[2];
|
private bool[] _CiaIRQOutput = new bool[2];
|
||||||
private bool _KeyboardNMIOutput;
|
private bool _KeyboardNMIOutput;
|
||||||
private bool _VicAECOutput;
|
private bool _VicAECOutput;
|
||||||
|
private bool _VicBAOutput;
|
||||||
private bool _VicIRQOutput;
|
private bool _VicIRQOutput;
|
||||||
private bool _VicLPInput;
|
private bool _VicLPInput;
|
||||||
|
|
||||||
|
@ -182,9 +190,11 @@ namespace BizHawk.Emulation.Computers.Commodore64
|
||||||
public bool CpuAEC { get { return _VicAECOutput; } }
|
public bool CpuAEC { get { return _VicAECOutput; } }
|
||||||
public bool CpuIRQ { get { return _VicIRQOutput | _CiaIRQOutput[0]; } }
|
public bool CpuIRQ { get { return _VicIRQOutput | _CiaIRQOutput[0]; } }
|
||||||
public bool CpuNMI { get { return _CiaIRQOutput[1] | _KeyboardNMIOutput; } }
|
public bool CpuNMI { get { return _CiaIRQOutput[1] | _KeyboardNMIOutput; } }
|
||||||
|
public bool CpuRDY { get { return !_VicBAOutput; } }
|
||||||
public bool KeyboardNMI { get { return _KeyboardNMIOutput; } set { _KeyboardNMIOutput = value; } }
|
public bool KeyboardNMI { get { return _KeyboardNMIOutput; } set { _KeyboardNMIOutput = value; } }
|
||||||
public bool LPOutput { get { return _VicLPInput; } set { _VicLPInput = value; } }
|
public bool LPOutput { get { return _VicLPInput; } set { _VicLPInput = value; } }
|
||||||
public bool VicAEC { get { return _VicAECOutput; } set { _VicAECOutput = value; } }
|
public bool VicAEC { get { return _VicAECOutput; } set { _VicAECOutput = value; } }
|
||||||
|
public bool VicBA { get { return _VicBAOutput; } set { _VicBAOutput = value; } }
|
||||||
public bool VicIRQ { get { return _VicIRQOutput; } set { _VicIRQOutput = value; } }
|
public bool VicIRQ { get { return _VicIRQOutput; } set { _VicIRQOutput = value; } }
|
||||||
public bool VicLP { get { return _VicLPInput; } }
|
public bool VicLP { get { return _VicLPInput; } }
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,11 +103,13 @@ namespace BizHawk.Emulation.Computers.Commodore64
|
||||||
for (int i = 0; i < cyclesPerFrame; i++)
|
for (int i = 0; i < cyclesPerFrame; i++)
|
||||||
{
|
{
|
||||||
if (!haltCPU)
|
if (!haltCPU)
|
||||||
|
{
|
||||||
|
cpu.IRQ = signal.CpuIRQ;
|
||||||
|
cpu.NMI = signal.CpuNMI;
|
||||||
cpu.ExecuteOne();
|
cpu.ExecuteOne();
|
||||||
|
}
|
||||||
|
|
||||||
vic.PerformCycle();
|
vic.PerformCycle();
|
||||||
cpu.IRQ = signal.CpuIRQ;
|
|
||||||
cpu.NMI = signal.CpuNMI;
|
|
||||||
cia0.PerformCycle();
|
cia0.PerformCycle();
|
||||||
signal.CiaIRQ0 = cia0.IRQ;
|
signal.CiaIRQ0 = cia0.IRQ;
|
||||||
cia1.PerformCycle();
|
cia1.PerformCycle();
|
||||||
|
|
|
@ -50,7 +50,7 @@ namespace BizHawk.Emulation.Computers.Commodore64
|
||||||
displayEnabled = (displayEnabled | DEN);
|
displayEnabled = (displayEnabled | DEN);
|
||||||
|
|
||||||
if (RASTER >= 0x030 && RASTER < 0x0F8)
|
if (RASTER >= 0x030 && RASTER < 0x0F8)
|
||||||
badline = badline | ((YSCROLL == (RASTER & 0x07)) && displayEnabled);
|
badline = ((YSCROLL == (RASTER & 0x07)) && displayEnabled);
|
||||||
else
|
else
|
||||||
badline = false;
|
badline = false;
|
||||||
|
|
||||||
|
@ -555,7 +555,8 @@ namespace BizHawk.Emulation.Computers.Commodore64
|
||||||
badline = false;
|
badline = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
PipelineBA(baCount > 0);
|
signal.VicBA = (baCount > 0);
|
||||||
|
PipelineBA(signal.VicBA);
|
||||||
if (baCount > 0)
|
if (baCount > 0)
|
||||||
{
|
{
|
||||||
if (fetchCounter > 0)
|
if (fetchCounter > 0)
|
||||||
|
@ -640,25 +641,28 @@ namespace BizHawk.Emulation.Computers.Commodore64
|
||||||
|
|
||||||
private void PipelineFetchSpriteP(int index)
|
private void PipelineFetchSpriteP(int index)
|
||||||
{
|
{
|
||||||
|
VicIISprite spr = sprites[index];
|
||||||
ushort pointerOffset = (ushort)((VM << 10) | 0x3F8 | index);
|
ushort pointerOffset = (ushort)((VM << 10) | 0x3F8 | index);
|
||||||
sprites[index].MPTR = mem.VicRead(pointerOffset);
|
|
||||||
|
|
||||||
if (sprites[index].MDMA)
|
spr.MPTR = mem.VicRead(pointerOffset);
|
||||||
|
|
||||||
|
if (spr.MDMA)
|
||||||
{
|
{
|
||||||
sprites[index].MSR = mem.VicRead((ushort)((sprites[index].MPTR << 6) | (sprites[index].MC)));
|
spr.MSR = mem.VicRead((ushort)((spr.MPTR << 6) | (spr.MC)));
|
||||||
sprites[index].MC++;
|
spr.MC++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void PipelineFetchSpriteS(int index)
|
private void PipelineFetchSpriteS(int index)
|
||||||
{
|
{
|
||||||
if (sprites[index].MDMA)
|
VicIISprite spr = sprites[index];
|
||||||
|
if (spr.MDMA)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 2; i++)
|
for (int i = 0; i < 2; i++)
|
||||||
{
|
{
|
||||||
sprites[index].MSR <<= 8;
|
spr.MSR <<= 8;
|
||||||
sprites[index].MSR |= mem.VicRead((ushort)((sprites[index].MPTR << 6) | (sprites[index].MC)));
|
spr.MSR |= mem.VicRead((ushort)((spr.MPTR << 6) | (spr.MC)));
|
||||||
sprites[index].MC++;
|
spr.MC++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,8 @@ namespace BizHawk.Emulation.Computers.Commodore64
|
||||||
{
|
{
|
||||||
0x0845, 0x0885, 0x0856, 0x0886, 0x0867,
|
0x0845, 0x0885, 0x0856, 0x0886, 0x0867,
|
||||||
0x0887, 0x0887, 0x0888, 0x0888, 0x0888,
|
0x0887, 0x0887, 0x0888, 0x0888, 0x0888,
|
||||||
0x0888, 0x1888, 0x1888, 0x1888, 0x1888,
|
0x0888, 0x0888, 0x1888, 0x1888, 0x1888,
|
||||||
|
0x1888, 0x1888, 0x1888, 0x1888, 0x1888,
|
||||||
0x1888, 0x1888, 0x1888, 0x1888, 0x1888,
|
0x1888, 0x1888, 0x1888, 0x1888, 0x1888,
|
||||||
0x1888, 0x1888, 0x1888, 0x1888, 0x1888,
|
0x1888, 0x1888, 0x1888, 0x1888, 0x1888,
|
||||||
0x1888, 0x1888, 0x1888, 0x1888, 0x1888,
|
0x1888, 0x1888, 0x1888, 0x1888, 0x1888,
|
||||||
|
@ -66,7 +67,6 @@ namespace BizHawk.Emulation.Computers.Commodore64
|
||||||
0x1888, 0x1888, 0x1888, 0x1888, 0x1888,
|
0x1888, 0x1888, 0x1888, 0x1888, 0x1888,
|
||||||
0x1888, 0x1888, 0x1888, 0x1888, 0x1888,
|
0x1888, 0x1888, 0x1888, 0x1888, 0x1888,
|
||||||
0x1888, 0x1888, 0x1888, 0x1888, 0x1888,
|
0x1888, 0x1888, 0x1888, 0x1888, 0x1888,
|
||||||
0x1888, 0x1888, 0x1888, 0x1888, 0x0888,
|
|
||||||
0x0880, 0x0880, 0x0801, 0x0881, 0x0812,
|
0x0880, 0x0880, 0x0801, 0x0881, 0x0812,
|
||||||
0x0882, 0x0823, 0x0883, 0x0834, 0x0884
|
0x0882, 0x0823, 0x0883, 0x0834, 0x0884
|
||||||
},
|
},
|
||||||
|
@ -129,8 +129,8 @@ namespace BizHawk.Emulation.Computers.Commodore64
|
||||||
new uint[] // ba (flg/spr/spr/spr 8=none)
|
new uint[] // ba (flg/spr/spr/spr 8=none)
|
||||||
{
|
{
|
||||||
0x0884, 0x0845, 0x0885, 0x0856, 0x0886,
|
0x0884, 0x0845, 0x0885, 0x0856, 0x0886,
|
||||||
0x0867, 0x0887, 0x0888, 0x0888, 0x0888,
|
0x0867, 0x0887, 0x0887, 0x0888, 0x0888,
|
||||||
0x0888, 0x1888, 0x1888, 0x1888, 0x1888,
|
0x0888, 0x0888, 0x1888, 0x1888, 0x1888,
|
||||||
0x1888, 0x1888, 0x1888, 0x1888, 0x1888,
|
0x1888, 0x1888, 0x1888, 0x1888, 0x1888,
|
||||||
0x1888, 0x1888, 0x1888, 0x1888, 0x1888,
|
0x1888, 0x1888, 0x1888, 0x1888, 0x1888,
|
||||||
0x1888, 0x1888, 0x1888, 0x1888, 0x1888,
|
0x1888, 0x1888, 0x1888, 0x1888, 0x1888,
|
||||||
|
@ -138,7 +138,7 @@ namespace BizHawk.Emulation.Computers.Commodore64
|
||||||
0x1888, 0x1888, 0x1888, 0x1888, 0x1888,
|
0x1888, 0x1888, 0x1888, 0x1888, 0x1888,
|
||||||
0x1888, 0x1888, 0x1888, 0x1888, 0x1888,
|
0x1888, 0x1888, 0x1888, 0x1888, 0x1888,
|
||||||
0x1888, 0x1888, 0x1888, 0x1888, 0x1888,
|
0x1888, 0x1888, 0x1888, 0x1888, 0x1888,
|
||||||
0x1888, 0x1888, 0x1888, 0x1888, 0x0880,
|
0x1888, 0x1888, 0x1888, 0x1888, 0x1880,
|
||||||
0x0880, 0x0801, 0x0881, 0x0812, 0x0882,
|
0x0880, 0x0801, 0x0881, 0x0812, 0x0882,
|
||||||
0x0823, 0x0883, 0x0834
|
0x0823, 0x0883, 0x0834
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue