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