C64: Interrupts generated in phase 2 by the VIC won't trigger for the CPU until next cycle, also buffer BA
This commit is contained in:
parent
b471fdc692
commit
e63d10b608
|
@ -2,7 +2,7 @@
|
||||||
{
|
{
|
||||||
public sealed partial class Vic
|
public sealed partial class Vic
|
||||||
{
|
{
|
||||||
private const int BaResetCounter = 4;
|
private const int BaResetCounter = 6;
|
||||||
private const int PipelineUpdateVc = 0x00000001; // vc/rc rule 2
|
private const int PipelineUpdateVc = 0x00000001; // vc/rc rule 2
|
||||||
private const int PipelineSpriteCrunch = 0x00000002;
|
private const int PipelineSpriteCrunch = 0x00000002;
|
||||||
private const int PipelineUpdateMcBase = 0x00000004;
|
private const int PipelineUpdateMcBase = 0x00000004;
|
||||||
|
@ -336,13 +336,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
// perform BA flag manipulation
|
// perform BA flag manipulation
|
||||||
_pinBa = true;
|
_ba = true;
|
||||||
switch (_parseBa)
|
switch (_parseBa)
|
||||||
{
|
{
|
||||||
case BaTypeNone:
|
case BaTypeNone:
|
||||||
break;
|
break;
|
||||||
case BaTypeCharacter:
|
case BaTypeCharacter:
|
||||||
_pinBa = !_badline;
|
_ba = !_badline;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
_parseCycleBaSprite0 = _parseBa & BaTypeMaskSprite0;
|
_parseCycleBaSprite0 = _parseBa & BaTypeMaskSprite0;
|
||||||
|
@ -351,7 +351,7 @@
|
||||||
if ((_parseCycleBaSprite0 < 8 && _sprites[_parseCycleBaSprite0].Dma) ||
|
if ((_parseCycleBaSprite0 < 8 && _sprites[_parseCycleBaSprite0].Dma) ||
|
||||||
(_parseCycleBaSprite1 < 8 && _sprites[_parseCycleBaSprite1].Dma) ||
|
(_parseCycleBaSprite1 < 8 && _sprites[_parseCycleBaSprite1].Dma) ||
|
||||||
(_parseCycleBaSprite2 < 8 && _sprites[_parseCycleBaSprite2].Dma))
|
(_parseCycleBaSprite2 < 8 && _sprites[_parseCycleBaSprite2].Dma))
|
||||||
_pinBa = false;
|
_ba = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.MOS
|
||||||
private int _backgroundColor1;
|
private int _backgroundColor1;
|
||||||
private int _backgroundColor2;
|
private int _backgroundColor2;
|
||||||
private int _backgroundColor3;
|
private int _backgroundColor3;
|
||||||
|
private bool _ba;
|
||||||
private int _baCount;
|
private int _baCount;
|
||||||
private bool _badline;
|
private bool _badline;
|
||||||
private bool _badlineEnable;
|
private bool _badlineEnable;
|
||||||
|
@ -85,6 +86,7 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.MOS
|
||||||
_pinAec = true;
|
_pinAec = true;
|
||||||
_pinBa = true;
|
_pinBa = true;
|
||||||
_pinIrq = true;
|
_pinIrq = true;
|
||||||
|
_ba = true;
|
||||||
|
|
||||||
_bufOffset = 0;
|
_bufOffset = 0;
|
||||||
|
|
||||||
|
@ -160,6 +162,7 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.MOS
|
||||||
ser.Sync(nameof(_parseIsSprCrunch), ref _parseIsSprCrunch);
|
ser.Sync(nameof(_parseIsSprCrunch), ref _parseIsSprCrunch);
|
||||||
ser.Sync(nameof(_videoMode), ref _videoMode);
|
ser.Sync(nameof(_videoMode), ref _videoMode);
|
||||||
ser.Sync(nameof(_borderOnShiftReg), ref _borderOnShiftReg);
|
ser.Sync(nameof(_borderOnShiftReg), ref _borderOnShiftReg);
|
||||||
|
ser.Sync(nameof(_ba), ref _ba);
|
||||||
ser.Sync(nameof(_backgroundColor0), ref _backgroundColor0);
|
ser.Sync(nameof(_backgroundColor0), ref _backgroundColor0);
|
||||||
ser.Sync(nameof(_backgroundColor1), ref _backgroundColor1);
|
ser.Sync(nameof(_backgroundColor1), ref _backgroundColor1);
|
||||||
ser.Sync(nameof(_backgroundColor2), ref _backgroundColor2);
|
ser.Sync(nameof(_backgroundColor2), ref _backgroundColor2);
|
||||||
|
|
|
@ -310,20 +310,21 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.MOS
|
||||||
|
|
||||||
// render
|
// render
|
||||||
ParseCycle();
|
ParseCycle();
|
||||||
|
UpdateBa();
|
||||||
Render();
|
Render();
|
||||||
ParseCycle();
|
ParseCycle();
|
||||||
|
UpdateBa();
|
||||||
|
UpdatePins();
|
||||||
Render();
|
Render();
|
||||||
_extraColorModeBuffer = _extraColorMode;
|
_extraColorModeBuffer = _extraColorMode;
|
||||||
|
}
|
||||||
|
|
||||||
// if the BA counter is nonzero, allow CPU bus access
|
private void UpdateBa()
|
||||||
if (_pinBa)
|
{
|
||||||
|
if (_ba)
|
||||||
_baCount = BaResetCounter;
|
_baCount = BaResetCounter;
|
||||||
else if (_baCount > 0)
|
else if (_baCount >= 0)
|
||||||
_baCount--;
|
_baCount--;
|
||||||
_pinAec = _pinBa || _baCount > 0;
|
|
||||||
|
|
||||||
// must always come last
|
|
||||||
UpdatePins();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateBorder()
|
private void UpdateBorder()
|
||||||
|
@ -343,6 +344,8 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.MOS
|
||||||
(_enableIntLightPen & _intLightPen));
|
(_enableIntLightPen & _intLightPen));
|
||||||
|
|
||||||
_pinIrq = irqTemp;
|
_pinIrq = irqTemp;
|
||||||
|
_pinAec = _ba || _baCount >= 0;
|
||||||
|
_pinBa = _ba;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateVideoMode()
|
private void UpdateVideoMode()
|
||||||
|
|
Loading…
Reference in New Issue