C64: AEC does not prohibit the CPU from functioning, only BA (RDY) does

This commit is contained in:
SaxxonPike 2019-07-09 20:52:51 -05:00
parent 9758efe604
commit 2abe832289
4 changed files with 14 additions and 41 deletions

View File

@ -207,7 +207,6 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64
{
_board.InputRead = false;
_board.PollInput();
_board.Cpu.LagCycles = 0;
}
_board.Execute();

View File

@ -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++;

View File

@ -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)));
}
}
}

View File

@ -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;
}
}