C64: Implement sprite crunch and better vsync rates.

This commit is contained in:
SaxxonPike 2019-07-25 15:42:09 -05:00
parent 9f638ec1c2
commit c02eeaf08c
8 changed files with 31 additions and 28 deletions

View File

@ -30,7 +30,8 @@
return new Vic(
Cycles, Lines,
Pipeline,
14318181 / 14,
14318181,
14,
HblankStart, HblankEnd,
Vblankstart, VblankEnd,
borderType,

View File

@ -30,7 +30,8 @@
return new Vic(
Cycles, Lines,
Pipeline,
14318181 / 14,
14318181,
14,
HblankStart, HblankEnd,
VblankStart, VblankEnd,
borderType,

View File

@ -30,7 +30,8 @@
return new Vic(
Cycles, Lines,
Pipeline,
17734472 / 18,
17734472,
18,
HblankStart, HblankEnd,
VblankStart, VblankEnd,
borderType,

View File

@ -30,7 +30,8 @@
return new Vic(
Cycles, Lines,
Pipeline,
14328225 / 14,
14328225,
14,
HblankStart, HblankEnd,
VblankStart, VblankEnd,
borderType,

View File

@ -267,6 +267,20 @@
_borderCheckLEnable = (_parseAct & (PipelineBorderLeft0 | PipelineBorderLeft1)) != 0;
_borderCheckREnable = (_parseAct & (PipelineBorderRight0 | PipelineBorderRight1)) != 0;
if ((_parseAct & PipelineUpdateMcBase) != 0) // VIC addendum sprite rule 7
{
foreach (var spr in _sprites)
{
if (spr.YCrunch)
spr.Mcbase = spr.Mc;
else if (!spr.YExpand)
spr.Mcbase = SpriteCrunchTable[spr.Mcbase];
if (spr.Mcbase == 63)
spr.Dma = false;
}
}
foreach (var spr in _sprites) // sprite rule 1
{
if (!spr.YExpand)
@ -274,22 +288,7 @@
spr.YCrunch = true;
}
}
if ((_parseAct & PipelineUpdateMcBase) != 0) // VIC addendum sprite rule 7
{
foreach (var spr in _sprites)
{
if (spr.YCrunch)
{
spr.Mcbase = spr.Mc;
if (spr.Mcbase == 63)
{
spr.Dma = false;
}
}
}
}
if ((_parseAct & PipelineSpriteDma) != 0) // sprite rule 3
{
foreach (var spr in _sprites)

View File

@ -20,7 +20,7 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.MOS
private static readonly int[] TimingBuilderCycle14Act =
{
PipelineUpdateVc, 0,
PipelineSpriteCrunch, 0,
PipelineSpriteCrunch, PipelineSpriteCrunch,
PipelineUpdateMcBase, 0,
};

View File

@ -50,8 +50,8 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.MOS
public int VirtualHeight { get; private set; }
public int VsyncNumerator => CyclesPerSecond;
public int VsyncNumerator => _cyclesPerSecNum;
public int VsyncDenominator => CyclesPerFrame;
public int VsyncDenominator => CyclesPerFrame * _cyclesPerSecDen;
}
}

View File

@ -28,7 +28,6 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.MOS
public bool ReadBa() { return _pinBa; }
public bool ReadIrq() { return (_irqBuffer & 1) == 0; }
private readonly int _cyclesPerSec;
private readonly int[] _rasterXPipeline;
private readonly int[] _fetchPipeline;
private readonly int[] _baPipeline;
@ -42,8 +41,10 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.MOS
private readonly int _pixelRatioNum;
private readonly int _pixelRatioDen;
private readonly int _cyclesPerSecNum;
private readonly int _cyclesPerSecDen;
public Vic(int newCycles, int newLines, IList<int[]> newPipeline, int newCyclesPerSec, int hblankStart, int hblankEnd, int vblankStart, int vblankEnd, C64.BorderType borderType, int pixelRatioNum, int pixelRatioDen)
public Vic(int newCycles, int newLines, IList<int[]> newPipeline, int cyclesPerSecNum, int cyclesPerSecDen, int hblankStart, int hblankEnd, int vblankStart, int vblankEnd, C64.BorderType borderType, int pixelRatioNum, int pixelRatioDen)
{
Debug.WriteLine("C64 VIC timings:");
Debug.WriteLine("RX FTCH BA ACT");
@ -61,7 +62,8 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.MOS
_actPipeline = newPipeline[3];
_totalCycles = newCycles;
_totalLines = newLines;
_cyclesPerSec = newCyclesPerSec;
_cyclesPerSecNum = cyclesPerSecNum;
_cyclesPerSecDen = cyclesPerSecDen;
ConfigureBlanking(newLines, hblankStart, hblankEnd, vblankStart, vblankEnd, borderType);
@ -184,8 +186,6 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.MOS
public int CyclesPerFrame => _totalCycles * _totalLines;
public int CyclesPerSecond => _cyclesPerSec;
public void ExecutePhase1()
{
// phi1