From cdd0716420dd8a61c505f74a2073fe8c404bf852 Mon Sep 17 00:00:00 2001 From: adelikat Date: Sat, 24 Jan 2015 20:36:36 +0000 Subject: [PATCH] wire up memory execute callbacks to SMS and TI83 --- BizHawk.Emulation.Cores/CPUs/Z80/Execute.cs | 7 +++++++ BizHawk.Emulation.Cores/CPUs/Z80/Z80A.cs | 4 ++++ BizHawk.Emulation.Cores/Calculator/TI83.cs | 1 + BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.cs | 1 + 4 files changed, 13 insertions(+) diff --git a/BizHawk.Emulation.Cores/CPUs/Z80/Execute.cs b/BizHawk.Emulation.Cores/CPUs/Z80/Execute.cs index ef4c0aa48c..ed36f2c9f5 100644 --- a/BizHawk.Emulation.Cores/CPUs/Z80/Execute.cs +++ b/BizHawk.Emulation.Cores/CPUs/Z80/Execute.cs @@ -46,7 +46,14 @@ namespace BizHawk.Emulation.Cores.Components.Z80 { if (Debug) + { Logger(State()); + } + + if (MemoryCallbacks != null) + { + MemoryCallbacks.CallExecutes(RegPC.Word); + } ++RegR; switch (ReadMemory(RegPC.Word++)) diff --git a/BizHawk.Emulation.Cores/CPUs/Z80/Z80A.cs b/BizHawk.Emulation.Cores/CPUs/Z80/Z80A.cs index 9b8e4e6fcc..dc37155efd 100644 --- a/BizHawk.Emulation.Cores/CPUs/Z80/Z80A.cs +++ b/BizHawk.Emulation.Cores/CPUs/Z80/Z80A.cs @@ -1,7 +1,9 @@ using System; using System.Globalization; using System.IO; + using BizHawk.Common; +using BizHawk.Emulation.Common; // This Z80 emulator is a modified version of Ben Ryves 'Brazil' emulator. // It is MIT licensed. @@ -36,6 +38,8 @@ namespace BizHawk.Emulation.Cores.Components.Z80 public Func ReadMemory; public Action WriteMemory; + public IMemoryCallbackSystem MemoryCallbacks { get; set; } + // Utility function, not used by core public ushort ReadWord(ushort addr) { diff --git a/BizHawk.Emulation.Cores/Calculator/TI83.cs b/BizHawk.Emulation.Cores/Calculator/TI83.cs index 6bb7fba165..819dcca181 100644 --- a/BizHawk.Emulation.Cores/Calculator/TI83.cs +++ b/BizHawk.Emulation.Cores/Calculator/TI83.cs @@ -64,6 +64,7 @@ namespace BizHawk.Emulation.Cores.Calculators cpu.WriteHardware = WriteHardware; cpu.IRQCallback = IRQCallback; cpu.NMICallback = NMICallback; + cpu.MemoryCallbacks = MemoryCallbacks; this.rom = rom; LinkPort = new TI83LinkPort(this); diff --git a/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.cs b/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.cs index 8b3143e1ce..565b52e2a1 100644 --- a/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.cs +++ b/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.cs @@ -143,6 +143,7 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem Cpu.RegisterSP = 0xDFF0; Cpu.ReadHardware = ReadPort; Cpu.WriteHardware = WritePort; + Cpu.MemoryCallbacks = MemoryCallbacks; Vdp = new VDP(this, Cpu, IsGameGear ? VdpMode.GameGear : VdpMode.SMS, DisplayType); (ServiceProvider as BasicServiceProvider).Register(Vdp);