diff --git a/BizHawk.Emulation.Cores/Computers/Commodore64/C64.cs b/BizHawk.Emulation.Cores/Computers/Commodore64/C64.cs index 926942bbe4..1592c35a51 100644 --- a/BizHawk.Emulation.Cores/Computers/Commodore64/C64.cs +++ b/BizHawk.Emulation.Cores/Computers/Commodore64/C64.cs @@ -207,7 +207,6 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64 { _board.InputRead = false; _board.PollInput(); - _board.Cpu.LagCycles = 0; } _board.Execute(); diff --git a/BizHawk.Emulation.Cores/Computers/Commodore64/MOS/Chip6510.IDebuggable.cs b/BizHawk.Emulation.Cores/Computers/Commodore64/MOS/Chip6510.IDebuggable.cs index 67ba9a45c1..7dbe83fd05 100644 --- a/BizHawk.Emulation.Cores/Computers/Commodore64/MOS/Chip6510.IDebuggable.cs +++ b/BizHawk.Emulation.Cores/Computers/Commodore64/MOS/Chip6510.IDebuggable.cs @@ -97,7 +97,7 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.MOS private void StepOver() { - var instruction = CpuPeek(_cpu.PC); + var instruction = Peek(_cpu.PC); if (instruction == Jsr) { @@ -116,13 +116,13 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.MOS private void StepOut() { var instructionsBeforeBailout = 1000000; - var instr = CpuPeek(_cpu.PC); + var instr = Peek(_cpu.PC); _jsrCount = instr == Jsr ? 1 : 0; while (--instructionsBeforeBailout > 0) { StepInto(); - instr = CpuPeek(_cpu.PC); + instr = Peek(_cpu.PC); if (instr == Jsr) { _jsrCount++; diff --git a/BizHawk.Emulation.Cores/Computers/Commodore64/MOS/Chip6510.IDisassemblable.cs b/BizHawk.Emulation.Cores/Computers/Commodore64/MOS/Chip6510.IDisassemblable.cs index e5a9459c25..ccacc83988 100644 --- a/BizHawk.Emulation.Cores/Computers/Commodore64/MOS/Chip6510.IDisassemblable.cs +++ b/BizHawk.Emulation.Cores/Computers/Commodore64/MOS/Chip6510.IDisassemblable.cs @@ -27,7 +27,7 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.MOS public string Disassemble(MemoryDomain m, uint addr, out int length) { - return MOS6502X.Disassemble((ushort)addr, out length, CpuPeek); + return MOS6502X.Disassemble((ushort) addr, out length, a => unchecked((byte) Peek(a))); } } } diff --git a/BizHawk.Emulation.Cores/Computers/Commodore64/MOS/Chip6510.cs b/BizHawk.Emulation.Cores/Computers/Commodore64/MOS/Chip6510.cs index ba2ba3bf53..5d01e5edcf 100644 --- a/BizHawk.Emulation.Cores/Computers/Commodore64/MOS/Chip6510.cs +++ b/BizHawk.Emulation.Cores/Computers/Commodore64/MOS/Chip6510.cs @@ -67,25 +67,6 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.MOS set { _cpu.TraceCallback = value; } } - public void SetOverflow() - { - } - - private byte CpuPeek(ushort addr) - { - return unchecked((byte)Peek(addr)); - } - - private byte CpuRead(ushort addr) - { - return unchecked((byte)Read(addr)); - } - - private void CpuWrite(ushort addr, byte val) - { - Write(addr, val); - } - public void HardReset() { _cpu.NESSoftReset(); @@ -109,22 +90,15 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.MOS { _cpu.RDY = ReadRdy(); - if (ReadAec()) - { - _cpu.IRQ = !ReadIrq(); - _pinNmiLast = _thisNmi; - _thisNmi = ReadNmi(); - _cpu.NMI |= _pinNmiLast && !_thisNmi; - _cpu.ExecuteOne(); - } - else - { - LagCycles++; - } +// if (!ReadAec()) +// return; + _cpu.IRQ = !ReadIrq(); + _pinNmiLast = _thisNmi; + _thisNmi = ReadNmi(); + _cpu.NMI |= _pinNmiLast && !_thisNmi; + _cpu.ExecuteOne(); } - public int LagCycles; - internal bool AtInstructionStart() { return _cpu.AtInstructionStart(); @@ -216,7 +190,7 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.MOS case 0x0001: return PortData; default: - return ReadMemory(addr); + return ReadAec() ? ReadMemory(addr) : 0xFF; } } @@ -233,7 +207,6 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.MOS ser.EndSection(); ser.Sync(nameof(_thisNmi), ref _thisNmi); - ser.Sync(nameof(LagCycles), ref LagCycles); } public void Write(int addr, int val) @@ -249,7 +222,8 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.MOS WriteMemoryPort(addr, val); break; default: - WriteMemory(addr, val); + if (ReadAec()) + WriteMemory(addr, val); break; } }