revert r6072

This commit is contained in:
goyuken 2014-02-09 20:17:59 +00:00
parent c2abb01978
commit 094e7ca18f
5 changed files with 22 additions and 38 deletions

View File

@ -7,6 +7,9 @@ namespace BizHawk.Emulation.Cores.Components.H6280
{ {
public partial class HuC6280 public partial class HuC6280
{ {
public bool Debug;
public Action<string> Logger;
public void Execute(int cycles) public void Execute(int cycles)
{ {
sbyte rel8; sbyte rel8;
@ -55,7 +58,8 @@ namespace BizHawk.Emulation.Cores.Components.H6280
IRQControlByte = IRQNextControlByte; IRQControlByte = IRQNextControlByte;
LagIFlag = FlagI; LagIFlag = FlagI;
ExecuteCallbacks(); if (Debug) Logger(State());
CoreComm.MemoryCallbackSystem.CallExecute(PC);
byte opcode = ReadMemory(PC++); byte opcode = ReadMemory(PC++);
switch (opcode) switch (opcode)

View File

@ -9,24 +9,10 @@ namespace BizHawk.Emulation.Cores.Components.H6280
{ {
public sealed partial class HuC6280 public sealed partial class HuC6280
{ {
public Action<string> TraceLogger; public HuC6280(CoreComm comm)
public bool TraceEnabled;
public Action<uint> CallExecute;
void ExecuteCallbacks()
{
if (TraceEnabled)
{
TraceLogger(State());
}
if (CallExecute != null)
CallExecute(PC);
}
public HuC6280()
{ {
Reset(); Reset();
CoreComm = comm;
} }
public void Reset() public void Reset()
@ -363,6 +349,8 @@ namespace BizHawk.Emulation.Cores.Components.H6280
public Action<int, byte> WriteVDC; public Action<int, byte> WriteVDC;
public Action<int> ThinkAction = delegate { }; public Action<int> ThinkAction = delegate { };
public CoreComm CoreComm;
public byte ReadMemory(ushort address) public byte ReadMemory(ushort address)
{ {
byte page = MPR[address >> 13]; byte page = MPR[address >> 13];

View File

@ -93,13 +93,13 @@ namespace BizHawk.Emulation.Cores.PCEngine
void Init(GameInfo game, byte[] rom) void Init(GameInfo game, byte[] rom)
{ {
Controller = NullController.GetNullController(); Controller = NullController.GetNullController();
Cpu = new HuC6280(); Cpu = new HuC6280(CoreComm);
VCE = new VCE(); VCE = new VCE();
VDC1 = new VDC(this, Cpu, VCE); VDC1 = new VDC(this, Cpu, VCE);
PSG = new HuC6280PSG(); PSG = new HuC6280PSG();
SCSI = new ScsiCDBus(this, disc); SCSI = new ScsiCDBus(this, disc);
Cpu.TraceLogger = (s) => CoreComm.Tracer.Put(s); Cpu.Logger = (s) => CoreComm.Tracer.Put(s);
if (TurboGrafx) if (TurboGrafx)
{ {
@ -160,7 +160,7 @@ namespace BizHawk.Emulation.Cores.PCEngine
RomData = rom; RomData = rom;
RomLength = RomData.Length; RomLength = RomData.Length;
// user request: current value of the SF2MapperLatch on the tracelogger // user request: current value of the SF2MapperLatch on the tracelogger
Cpu.TraceLogger = (s) => CoreComm.Tracer.Put(string.Format("{0:X1}:{1}", SF2MapperLatch, s)); Cpu.Logger = (s) => CoreComm.Tracer.Put(string.Format("{0:X1}:{1}", SF2MapperLatch, s));
} }
else else
{ {
@ -260,19 +260,7 @@ namespace BizHawk.Emulation.Cores.PCEngine
Frame++; Frame++;
PSG.BeginFrame(Cpu.TotalExecutedCycles); PSG.BeginFrame(Cpu.TotalExecutedCycles);
Cpu.TraceEnabled = CoreComm.Tracer.Enabled; Cpu.Debug = CoreComm.Tracer.Enabled;
if (CoreComm.MemoryCallbackSystem.HasExecutes)
{
Cpu.CallExecute = delegate(uint addr)
{
CoreComm.MemoryCallbackSystem.CallExecute(addr);
};
}
else
{
Cpu.CallExecute = null;
}
if (SuperGrafx) if (SuperGrafx)
VPC.ExecFrame(render); VPC.ExecFrame(render);

View File

@ -438,10 +438,13 @@ namespace HuC6280
w.WriteLine("// Do not modify this file directly! This is GENERATED code."); w.WriteLine("// Do not modify this file directly! This is GENERATED code.");
w.WriteLine("// Please open the CpuCoreGenerator solution and make your modifications there."); w.WriteLine("// Please open the CpuCoreGenerator solution and make your modifications there.");
w.WriteLine(); w.WriteLine();
w.WriteLine("namespace BizHawk.Emulation.Cores.Components.H6280"); w.WriteLine("namespace BizHawk.Emulation.Common.Components.H6280");
w.WriteLine("{"); w.WriteLine("{");
w.WriteLine(" public partial class HuC6280"); w.WriteLine(" public partial class HuC6280");
w.WriteLine(" {"); w.WriteLine(" {");
w.WriteLine(" public bool Debug;");
w.WriteLine(" public Action<string> Logger;");
w.WriteLine();
w.WriteLine(" public void Execute(int cycles)"); w.WriteLine(" public void Execute(int cycles)");
w.WriteLine(" {"); w.WriteLine(" {");
w.WriteLine(" sbyte rel8;"); w.WriteLine(" sbyte rel8;");
@ -490,7 +493,8 @@ namespace HuC6280
w.WriteLine(" IRQControlByte = IRQNextControlByte;"); w.WriteLine(" IRQControlByte = IRQNextControlByte;");
w.WriteLine(" LagIFlag = FlagI;"); w.WriteLine(" LagIFlag = FlagI;");
w.WriteLine(); w.WriteLine();
w.WriteLine(" ExecuteCallbacks();"); w.WriteLine(" if (Debug) Logger(State());");
w.WriteLine(" CoreComm.MemoryCallbackSystem.CallExecute(PC);");
w.WriteLine(); w.WriteLine();
w.WriteLine(" byte opcode = ReadMemory(PC++);"); w.WriteLine(" byte opcode = ReadMemory(PC++);");
w.WriteLine(" switch (opcode)"); w.WriteLine(" switch (opcode)");
@ -749,7 +753,7 @@ namespace HuC6280
public void GenerateDisassembler(string file) public void GenerateDisassembler(string file)
{ {
var w = new StreamWriter(file, false); var w = new StreamWriter(file, false);
w.WriteLine("namespace BizHawk.Emulation.Cores.Components.H6280"); w.WriteLine("namespace BizHawk.Emulation.Common.Components.H6280");
w.WriteLine(); w.WriteLine();
w.WriteLine("// Do not modify this file directly! This is GENERATED code."); w.WriteLine("// Do not modify this file directly! This is GENERATED code.");
w.WriteLine("// Please open the CpuCoreGenerator solution and make your modifications there."); w.WriteLine("// Please open the CpuCoreGenerator solution and make your modifications there.");

View File

@ -10,7 +10,7 @@
var y = new HuC6280.CoreGenerator(); var y = new HuC6280.CoreGenerator();
y.InitOpcodeTable(); y.InitOpcodeTable();
y.GenerateDisassembler("../../../BizHawk.Emulation.Cores/CPUs/HuC6280/Disassembler.cs"); y.GenerateDisassembler("../../../BizHawk.Emulation.Common/CPUs/HuC6280/Disassembler.cs");
y.GenerateExecutor("../../../BizHawk.Emulation.Cores/CPUs/HuC6280/Execute.cs"); y.GenerateExecutor("../../../BizHawk.Emulation.Common/CPUs/HuC6280/Execute.cs");
} }
} }