add some ExecFetch stuff to NES/6502 cores for memorycallbacks and whatnot
This commit is contained in:
parent
323df9b92e
commit
9fed70a49c
|
@ -199,6 +199,17 @@ namespace BizHawk.Emulation.Common
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void CallExecute(uint addr)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < _writes.Count; i++)
|
||||||
|
{
|
||||||
|
if (_writeAddrs[i] == addr)
|
||||||
|
{
|
||||||
|
_writes[i]();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public bool HasReads { get { return _reads.Any(); } }
|
public bool HasReads { get { return _reads.Any(); } }
|
||||||
public bool HasWrites { get { return _writes.Any(); } }
|
public bool HasWrites { get { return _writes.Any(); } }
|
||||||
|
|
||||||
|
|
|
@ -590,6 +590,7 @@ namespace BizHawk.Emulation.CPUs.M6502
|
||||||
{
|
{
|
||||||
if (debug) Console.WriteLine(State());
|
if (debug) Console.WriteLine(State());
|
||||||
branch_irq_hack = false;
|
branch_irq_hack = false;
|
||||||
|
if (OnExecFetch != null) OnExecFetch(PC);
|
||||||
opcode = ReadMemory(PC++);
|
opcode = ReadMemory(PC++);
|
||||||
mi = -1;
|
mi = -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -180,6 +180,9 @@ namespace BizHawk.Emulation.CPUs.M6502
|
||||||
public Func<ushort, byte> PeekMemory;
|
public Func<ushort, byte> PeekMemory;
|
||||||
public Action<ushort, byte> WriteMemory;
|
public Action<ushort, byte> WriteMemory;
|
||||||
|
|
||||||
|
//this only calls when the first byte of an instruction is fetched.
|
||||||
|
public Action<ushort> OnExecFetch;
|
||||||
|
|
||||||
public void SetCallbacks
|
public void SetCallbacks
|
||||||
(
|
(
|
||||||
Func<ushort, byte> ReadMemory,
|
Func<ushort, byte> ReadMemory,
|
||||||
|
|
|
@ -160,6 +160,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
cpu.BCD_Enabled = false;
|
cpu.BCD_Enabled = false;
|
||||||
|
cpu.OnExecFetch = ExecFetch;
|
||||||
ppu = new PPU(this);
|
ppu = new PPU(this);
|
||||||
ram = new byte[0x800];
|
ram = new byte[0x800];
|
||||||
CIRAM = new byte[0x800];
|
CIRAM = new byte[0x800];
|
||||||
|
@ -512,6 +513,11 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
||||||
//old data bus values from previous reads
|
//old data bus values from previous reads
|
||||||
public byte DB;
|
public byte DB;
|
||||||
|
|
||||||
|
public void ExecFetch(ushort addr)
|
||||||
|
{
|
||||||
|
CoreComm.MemoryCallbackSystem.CallExecute(addr);
|
||||||
|
}
|
||||||
|
|
||||||
public byte ReadMemory(ushort addr)
|
public byte ReadMemory(ushort addr)
|
||||||
{
|
{
|
||||||
byte ret;
|
byte ret;
|
||||||
|
|
Loading…
Reference in New Issue