do read/writes in the z80 core itself, refactor sms and ti83 to not use them on their end of the callback, fixes sms only having read/write callbacks on a few mappers

This commit is contained in:
adelikat 2015-01-24 20:57:37 +00:00
parent cdd0716420
commit 8c12c5cbff
5 changed files with 1373 additions and 1363 deletions

File diff suppressed because it is too large Load Diff

View File

@ -38,6 +38,26 @@ namespace BizHawk.Emulation.Cores.Components.Z80
public Func<ushort, byte> ReadMemory;
public Action<ushort, byte> WriteMemory;
public byte ReadMemoryWrapper(ushort addr)
{
if (MemoryCallbacks != null)
{
MemoryCallbacks.CallReads(addr);
}
return ReadMemory(addr);
}
public void WriteMemoryWrapper(ushort addr, byte value)
{
if (MemoryCallbacks != null)
{
MemoryCallbacks.CallWrites(addr);
}
WriteMemory(addr, value);
}
public IMemoryCallbackSystem MemoryCallbacks { get; set; }
// Utility function, not used by core

View File

@ -97,8 +97,6 @@ namespace BizHawk.Emulation.Cores.Calculators
ret = rom[romPage * 0x4000 + addr - 0x4000]; //other rom page
else ret = ram[addr - 0x8000];
MemoryCallbacks.CallReads(addr);
return ret;
}
@ -109,8 +107,6 @@ namespace BizHawk.Emulation.Cores.Calculators
else if (addr < 0x8000)
return; //other rom page
else ram[addr - 0x8000] = value;
MemoryCallbacks.CallWrites(addr);
}
public void WriteHardware(ushort addr, byte value)

View File

@ -16,7 +16,6 @@
else
ret = SystemRam[address & RamSizeMask];
MemoryCallbacks.CallReads(address);
return ret;
}
@ -26,8 +25,6 @@
ExtRam[address & ExtRamMask] = value;
else if (address >= 0xC000)
SystemRam[address & RamSizeMask] = value;
MemoryCallbacks.CallWrites((uint)address);
}
void InitExt2kMapper(int size)

View File

@ -53,8 +53,6 @@
ret = SystemRam[address & RamSizeMask];
}
MemoryCallbacks.CallReads(address);
return ret;
}
@ -91,7 +89,6 @@
else if (address == 0xFFFF) RomBank2 = (byte)(value % RomBanks);
return;
}
MemoryCallbacks.CallWrites((uint)address);
}
void InitSegaMapper()