diff --git a/BizHawk.Emulation/Computers/Commodore64/MOS/MOS6510.cs b/BizHawk.Emulation/Computers/Commodore64/MOS/MOS6510.cs index 9b01166682..c4198cd394 100644 --- a/BizHawk.Emulation/Computers/Commodore64/MOS/MOS6510.cs +++ b/BizHawk.Emulation/Computers/Commodore64/MOS/MOS6510.cs @@ -70,9 +70,6 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS public void ExecutePhase2() { - if (chips.vic.BA) - freezeCpu = false; - if (chips.vic.AEC && !freezeCpu) { // the 6502 core expects active high @@ -88,6 +85,9 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS cpu.ExecuteOne(); } + // unfreeze cpu if BA is high + if (chips.vic.BA) freezeCpu = false; + // process unused pin TTL if (unusedPinTTL0 == 0) unusedPin0 = false; diff --git a/BizHawk.Emulation/Computers/Commodore64/MOS/Vic.VideoProvider.cs b/BizHawk.Emulation/Computers/Commodore64/MOS/Vic.VideoProvider.cs index e804e1d654..43c1a40ccf 100644 --- a/BizHawk.Emulation/Computers/Commodore64/MOS/Vic.VideoProvider.cs +++ b/BizHawk.Emulation/Computers/Commodore64/MOS/Vic.VideoProvider.cs @@ -58,13 +58,5 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS { get { return bufWidth; } } - - private void WritePixel(uint pixel) - { - buf[bufOffset] = palette[pixel]; - bufOffset++; - if (bufOffset == bufLength) - bufOffset = 0; - } } } diff --git a/BizHawk.Emulation/Computers/Commodore64/MOS/Vic.cs b/BizHawk.Emulation/Computers/Commodore64/MOS/Vic.cs index c97b156213..8bb2cddba0 100644 --- a/BizHawk.Emulation/Computers/Commodore64/MOS/Vic.cs +++ b/BizHawk.Emulation/Computers/Commodore64/MOS/Vic.cs @@ -487,9 +487,9 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS pinBA = !badline; break; default: - cycleBAsprite0 = ba & 0x000F; - cycleBAsprite1 = ba & 0x00F0; - cycleBAsprite2 = ba & 0x0F00; + cycleBAsprite0 = (ba & 0x000F); + cycleBAsprite1 = (ba & 0x00F0) >> 4; + cycleBAsprite2 = (ba & 0x0F00) >> 8; if ((cycleBAsprite0 < 8 && sprites[cycleBAsprite0].dma) || (cycleBAsprite1 < 8 && sprites[cycleBAsprite1].dma) || (cycleBAsprite2 < 8 && sprites[cycleBAsprite2].dma)) @@ -609,7 +609,10 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS // render visible pixel pixel = pixelBuffer[pixelBufferIndex]; - WritePixel(pixel); + buf[bufOffset] = palette[pixel]; + bufOffset++; + if (bufOffset == bufLength) + bufOffset = 0; // put the pixel from the background buffer into the main buffer pixel = pixelBackgroundBuffer[pixelBackgroundBufferIndex];