fix crash in PCE debugger by adding peek and poke to the cpu instead of using read/write memory which triggers callbacks. however, the peek and poke are incomplete, as this requires deeper development (in this case, implementation in the memory maps)

This commit is contained in:
zeromus 2021-04-24 23:20:00 -04:00
parent aad592cc1c
commit 31d83d0d6e
2 changed files with 15 additions and 5 deletions

View File

@ -322,10 +322,15 @@ namespace BizHawk.Emulation.Cores.Components.H6280
public IMemoryCallbackSystem MemoryCallbacks;
public byte ReadMemory(ushort address)
public byte PeekMemory(ushort address)
{
byte page = MPR[address >> 13];
var result = ReadMemory21((page << 13) | (address & 0x1FFF));
return ReadMemory21((page << 13) | (address & 0x1FFF));
}
public byte ReadMemory(ushort address)
{
byte result = PeekMemory(address);
if (MemoryCallbacks.HasReads)
{
@ -336,10 +341,15 @@ namespace BizHawk.Emulation.Cores.Components.H6280
return result;
}
public void WriteMemory(ushort address, byte value)
public void PokeMemory(ushort address, byte value)
{
byte page = MPR[address >> 13];
WriteMemory21((page << 13) | (address & 0x1FFF), value);
}
public void WriteMemory(ushort address, byte value)
{
PokeMemory(address, value);
if (MemoryCallbacks.HasWrites)
{
uint flags = (uint)(MemoryCallbackFlags.AccessWrite);

View File

@ -37,13 +37,13 @@ namespace BizHawk.Emulation.Cores.PCEngine
{
if (addr < 0 || addr >= 0x10000)
throw new ArgumentOutOfRangeException();
return Cpu.ReadMemory((ushort)addr);
return Cpu.PeekMemory((ushort)addr);
},
(addr, value) =>
{
if (addr < 0 || addr >= 0x10000)
throw new ArgumentOutOfRangeException();
Cpu.WriteMemory((ushort)addr, value);
Cpu.PokeMemory((ushort)addr, value);
},
wordSize: 2);
domains.Add(cpuBusDomain);