commodore64: a little hack to emulate the 6502 RDY pin behavior
This commit is contained in:
parent
a1b8b387d0
commit
64fcb75723
|
@ -35,6 +35,9 @@ namespace BizHawk.Emulation.Computers.Commodore64
|
|||
public VicIINew vic;
|
||||
public ChipSignals signal;
|
||||
|
||||
// cpu
|
||||
private bool haltCPU;
|
||||
|
||||
public bool DriveLED
|
||||
{
|
||||
get
|
||||
|
@ -65,7 +68,7 @@ namespace BizHawk.Emulation.Computers.Commodore64
|
|||
{
|
||||
// initalize cpu
|
||||
cpu = new MOS6502X();
|
||||
cpu.ReadMemory = ReadMemory;
|
||||
cpu.ReadMemory = ReadMemoryCPU;
|
||||
cpu.WriteMemory = WriteMemory;
|
||||
cpu.DummyReadMemory = PeekMemory;
|
||||
|
||||
|
@ -150,6 +153,13 @@ namespace BizHawk.Emulation.Computers.Commodore64
|
|||
return mem.Read(addr);
|
||||
}
|
||||
|
||||
private byte ReadMemoryCPU(ushort addr)
|
||||
{
|
||||
if (!signal.CpuAEC)
|
||||
haltCPU = true;
|
||||
return mem.Read(addr);
|
||||
}
|
||||
|
||||
public void WriteMemory(ushort addr, byte value)
|
||||
{
|
||||
mem.Write(addr, value);
|
||||
|
|
|
@ -102,10 +102,9 @@ namespace BizHawk.Emulation.Computers.Commodore64
|
|||
// perform the cycle
|
||||
for (int i = 0; i < cyclesPerFrame; i++)
|
||||
{
|
||||
if (signal.CpuAEC)
|
||||
{
|
||||
if (!haltCPU)
|
||||
cpu.ExecuteOne();
|
||||
}
|
||||
|
||||
vic.PerformCycle();
|
||||
cpu.IRQ = signal.CpuIRQ;
|
||||
cpu.NMI = signal.CpuNMI;
|
||||
|
@ -114,8 +113,13 @@ namespace BizHawk.Emulation.Computers.Commodore64
|
|||
cia1.PerformCycle();
|
||||
signal.CiaIRQ1 = cia1.IRQ;
|
||||
sid.PerformCycle();
|
||||
|
||||
if (diskDriveAttached)
|
||||
diskDrive.PerformCycle();
|
||||
|
||||
if (signal.CpuAEC)
|
||||
haltCPU = false;
|
||||
|
||||
}
|
||||
|
||||
_islag = !mem.inputWasRead;
|
||||
|
|
|
@ -475,7 +475,7 @@ namespace BizHawk.Emulation.Computers.Commodore64
|
|||
{
|
||||
int timer = regs.T[index];
|
||||
timer--;
|
||||
if (timer == 0)
|
||||
if (timer < 0)
|
||||
{
|
||||
underflow[index] = true;
|
||||
if (regs.RUNMODE[index])
|
||||
|
|
|
@ -101,6 +101,8 @@ namespace BizHawk.Emulation.Computers.Commodore64
|
|||
cia1 = newCia1;
|
||||
|
||||
cpuPort = cpuPortBus.Connect();
|
||||
cpuPort.Latch = 0x00;
|
||||
cpuPort.Direction = 0x1F;
|
||||
cpuPortBus.AttachWriteHook(UpdateLayout);
|
||||
|
||||
cpuIO = cpuPortBus.Connect();
|
||||
|
|
Loading…
Reference in New Issue