diff --git a/BizHawk.Emulation.Cores/Computers/Commodore64/MOS/Vic.Registers.cs b/BizHawk.Emulation.Cores/Computers/Commodore64/MOS/Vic.Registers.cs index 85fa2e8fbc..50424f36b5 100644 --- a/BizHawk.Emulation.Cores/Computers/Commodore64/MOS/Vic.Registers.cs +++ b/BizHawk.Emulation.Cores/Computers/Commodore64/MOS/Vic.Registers.cs @@ -214,7 +214,6 @@ _intSpriteCollision = false; if ((val & 0x08) != 0) _intLightPen = false; - UpdatePins(); break; case 0x1E: case 0x1F: @@ -358,14 +357,12 @@ _intSpriteDataCollision = (val & 0x02) != 0; _intSpriteCollision = (val & 0x04) != 0; _intLightPen = (val & 0x08) != 0; - UpdatePins(); break; case 0x1A: _enableIntRaster = (val & 0x01) != 0; _enableIntSpriteDataCollision = (val & 0x02) != 0; _enableIntSpriteCollision = (val & 0x04) != 0; _enableIntLightPen = (val & 0x08) != 0; - UpdatePins(); break; case 0x1B: _sprite0.Priority = (val & 0x01) != 0; diff --git a/BizHawk.Emulation.Cores/Computers/Commodore64/MOS/Vic.cs b/BizHawk.Emulation.Cores/Computers/Commodore64/MOS/Vic.cs index 85c3230826..fe987dd613 100644 --- a/BizHawk.Emulation.Cores/Computers/Commodore64/MOS/Vic.cs +++ b/BizHawk.Emulation.Cores/Computers/Commodore64/MOS/Vic.cs @@ -26,7 +26,7 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.MOS public bool ReadAec() { return _pinAec; } public bool ReadBa() { return _pinBa; } - public bool ReadIrq() { return (_irqBuffer & 1) != 0; } + public bool ReadIrq() { return (_irqBuffer & 1) == 0; } private readonly int _cyclesPerSec; private readonly int[] _rasterXPipeline; @@ -320,7 +320,7 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.MOS { if (_ba) _baCount = BaResetCounter; - else if (_baCount >= 0) + else if (_baCount > 0) _baCount--; } @@ -334,16 +334,16 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.MOS private void UpdatePins() { - var irqTemp = !( + var irqTemp = (_enableIntRaster & _intRaster) | (_enableIntSpriteDataCollision & _intSpriteDataCollision) | (_enableIntSpriteCollision & _intSpriteCollision) | - (_enableIntLightPen & _intLightPen)); + (_enableIntLightPen & _intLightPen); // IRQ buffer is treated as a delay line _irqBuffer >>= 1; - _irqBuffer |= irqTemp ? 0x1 : 0; - _pinAec = _ba || _baCount >= 0; + _irqBuffer |= irqTemp ? 0x8 : 0; + _pinAec = _ba || _baCount > 0; _pinBa = _ba; }