From d477bc1fb6bb30ae89ab6716e8d7eb9d640fe4a0 Mon Sep 17 00:00:00 2001 From: adelikat Date: Sun, 28 Feb 2016 08:07:02 -0500 Subject: [PATCH] nice Trace header for SMS, and Coleco --- BizHawk.Emulation.Cores/CPUs/Z80/Execute.cs | 5 +++++ .../Consoles/Coleco/ColecoVision.cs | 1 + .../Consoles/Nintendo/QuickNES/QuickNES.ITraceable.cs | 4 +++- BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.cs | 10 +++++++--- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/BizHawk.Emulation.Cores/CPUs/Z80/Execute.cs b/BizHawk.Emulation.Cores/CPUs/Z80/Execute.cs index 133c2916b7..e9781e66de 100644 --- a/BizHawk.Emulation.Cores/CPUs/Z80/Execute.cs +++ b/BizHawk.Emulation.Cores/CPUs/Z80/Execute.cs @@ -11950,6 +11950,11 @@ namespace BizHawk.Emulation.Cores.Components.Z80 // TODO, not super thrilled with the existing Z80 disassembler, lets see if we can find something decent to replace it with Disassembler Disassembler = new Disassembler(); + public string TraceHeader + { + get { return "Z80: PC, opcode, registers (AF, BC, DE, HL, IX, IY, SP, Cy Flags (CNP3H5ZS)"; } + } + public TraceInfo State() { ushort tempPC = RegPC.Word; diff --git a/BizHawk.Emulation.Cores/Consoles/Coleco/ColecoVision.cs b/BizHawk.Emulation.Cores/Consoles/Coleco/ColecoVision.cs index 734a332446..102c9f5e59 100644 --- a/BizHawk.Emulation.Cores/Consoles/Coleco/ColecoVision.cs +++ b/BizHawk.Emulation.Cores/Consoles/Coleco/ColecoVision.cs @@ -56,6 +56,7 @@ namespace BizHawk.Emulation.Cores.ColecoVision this.game = game; SetupMemoryDomains(); + Tracer.Header = Cpu.TraceHeader; var serviceProvider = ServiceProvider as BasicServiceProvider; serviceProvider.Register(new Disassembler()); serviceProvider.Register(Tracer); diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/QuickNES/QuickNES.ITraceable.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/QuickNES/QuickNES.ITraceable.cs index 6267bedc00..080ffc6067 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/QuickNES/QuickNES.ITraceable.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/QuickNES/QuickNES.ITraceable.cs @@ -1,4 +1,6 @@ using System; +using System.Runtime.InteropServices; + using BizHawk.Emulation.Common; using BizHawk.Emulation.Cores.Components.M6502; @@ -13,7 +15,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES private void MakeTrace(IntPtr data) { int[] s = new int[7]; - System.Runtime.InteropServices.Marshal.Copy(data, s, 0, 7); + Marshal.Copy(data, s, 0, 7); byte a = (byte)s[0]; byte x = (byte)s[1]; diff --git a/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.cs b/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.cs index fde4cac977..2e5165cc95 100644 --- a/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.cs +++ b/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.cs @@ -107,8 +107,7 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem IsGameGear = game.System == "GG"; IsSG1000 = game.System == "SG"; RomData = rom; - Tracer = new TraceBuffer(); - (ServiceProvider as BasicServiceProvider).Register(Tracer); + if (RomData.Length % BankSize != 0) Array.Resize(ref RomData, ((RomData.Length / BankSize) + 1) * BankSize); RomBanks = (byte)(RomData.Length / BankSize); @@ -218,7 +217,12 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem //this manages the linkage between the cpu and mapper callbacks so it needs running before bootup is complete ((ICodeDataLogger)this).SetCDL(null); - (ServiceProvider as BasicServiceProvider).Register(new Disassembler()); + Tracer = new TraceBuffer { Header = Cpu.TraceHeader }; + + var serviceProvider = ServiceProvider as BasicServiceProvider; + serviceProvider.Register(Tracer); + serviceProvider.Register(new Disassembler()); + } public IEmulatorServiceProvider ServiceProvider { get; private set; }