diff --git a/BizHawk.Emulation.Cores/Computers/Commodore64/MOS/Chip6510.cs b/BizHawk.Emulation.Cores/Computers/Commodore64/MOS/Chip6510.cs index 278c052e1e..5d00eaef28 100644 --- a/BizHawk.Emulation.Cores/Computers/Commodore64/MOS/Chip6510.cs +++ b/BizHawk.Emulation.Cores/Computers/Commodore64/MOS/Chip6510.cs @@ -85,11 +85,11 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.MOS public void ExecutePhase() { + _cpu.RDY = ReadRdy(); _irqDelay >>= 1; _nmiDelay >>= 1; _irqDelay |= ReadIrq() ? 0x0 : 0x2; _nmiDelay |= ReadNmi() ? 0x0 : 0x2; - _cpu.RDY = ReadRdy(); _cpu.IRQ = (_irqDelay & 1) != 0; _cpu.NMI |= (_nmiDelay & 3) == 2; _cpu.ExecuteOne(); diff --git a/BizHawk.Emulation.Cores/Computers/Commodore64/MOS/Vic.State.cs b/BizHawk.Emulation.Cores/Computers/Commodore64/MOS/Vic.State.cs index 90e59b55e8..36291d8748 100644 --- a/BizHawk.Emulation.Cores/Computers/Commodore64/MOS/Vic.State.cs +++ b/BizHawk.Emulation.Cores/Computers/Commodore64/MOS/Vic.State.cs @@ -50,6 +50,7 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.MOS private int _pointerCb; private int _pointerVm; private int _rasterInterruptLine; + private bool _rasterInterruptTriggered; private int _rasterLine; private int _rasterX; private bool _rasterXHold; diff --git a/BizHawk.Emulation.Cores/Computers/Commodore64/MOS/Vic.cs b/BizHawk.Emulation.Cores/Computers/Commodore64/MOS/Vic.cs index 7c1d86284a..0a89972356 100644 --- a/BizHawk.Emulation.Cores/Computers/Commodore64/MOS/Vic.cs +++ b/BizHawk.Emulation.Cores/Computers/Commodore64/MOS/Vic.cs @@ -220,6 +220,9 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.MOS _vc = 0; _refreshCounter = 0xFF; } + + if (_rasterLine == BadLineDisableRaster) + _badlineEnable = false; } // bg collision clear @@ -242,17 +245,15 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.MOS _spriteSpriteCollisionClearPending = false; } - // start of rasterline - if ((_cycle == RasterIrqLineXCycle && _rasterLine > 0) || (_cycle == RasterIrqLine0Cycle && _rasterLine == 0)) + // raster IRQ is edge triggered + if (_rasterInterruptLine != _rasterLine) { - if (_rasterLine == BadLineDisableRaster) - _badlineEnable = false; - - // raster compares are done here - if (_rasterLine == _rasterInterruptLine) - { - _intRaster = true; - } + _rasterInterruptTriggered = false; + } + else if (!_rasterInterruptTriggered) + { + _intRaster = true; + _rasterInterruptTriggered = true; } // render