Trace logging support for ColecoVision
This commit is contained in:
parent
8239c39213
commit
1635cf9b30
|
@ -1,11 +1,4 @@
|
||||||
using System;
|
using BizHawk.Emulation.Common;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
|
||||||
|
|
||||||
using BizHawk.Common;
|
|
||||||
using BizHawk.Common.NumberExtensions;
|
|
||||||
|
|
||||||
using BizHawk.Emulation.Common;
|
|
||||||
using BizHawk.Emulation.Common.Components;
|
using BizHawk.Emulation.Common.Components;
|
||||||
using BizHawk.Emulation.Cores.Components.Z80;
|
using BizHawk.Emulation.Cores.Components.Z80;
|
||||||
|
|
||||||
|
@ -31,6 +24,7 @@ namespace BizHawk.Emulation.Cores.ColecoVision
|
||||||
public TMS9918A VDP;
|
public TMS9918A VDP;
|
||||||
public SN76489 PSG;
|
public SN76489 PSG;
|
||||||
public byte[] Ram = new byte[1024];
|
public byte[] Ram = new byte[1024];
|
||||||
|
private readonly TraceBuffer Tracer = new TraceBuffer();
|
||||||
|
|
||||||
[CoreConstructor("Coleco")]
|
[CoreConstructor("Coleco")]
|
||||||
public ColecoVision(CoreComm comm, GameInfo game, byte[] rom, object SyncSettings)
|
public ColecoVision(CoreComm comm, GameInfo game, byte[] rom, object SyncSettings)
|
||||||
|
@ -39,7 +33,7 @@ namespace BizHawk.Emulation.Cores.ColecoVision
|
||||||
MemoryCallbacks = new MemoryCallbackSystem();
|
MemoryCallbacks = new MemoryCallbackSystem();
|
||||||
CoreComm = comm;
|
CoreComm = comm;
|
||||||
_syncSettings = (ColecoSyncSettings)SyncSettings ?? new ColecoSyncSettings();
|
_syncSettings = (ColecoSyncSettings)SyncSettings ?? new ColecoSyncSettings();
|
||||||
bool skipbios = this._syncSettings.SkipBiosIntro;
|
bool skipbios = _syncSettings.SkipBiosIntro;
|
||||||
|
|
||||||
Cpu = new Z80A();
|
Cpu = new Z80A();
|
||||||
Cpu.ReadMemory = ReadMemory;
|
Cpu.ReadMemory = ReadMemory;
|
||||||
|
@ -61,7 +55,10 @@ namespace BizHawk.Emulation.Cores.ColecoVision
|
||||||
LoadRom(rom, skipbios);
|
LoadRom(rom, skipbios);
|
||||||
this.game = game;
|
this.game = game;
|
||||||
SetupMemoryDomains();
|
SetupMemoryDomains();
|
||||||
(ServiceProvider as BasicServiceProvider).Register<IDisassemblable>(new Disassembler());
|
|
||||||
|
var serviceProvider = ServiceProvider as BasicServiceProvider;
|
||||||
|
serviceProvider.Register<IDisassemblable>(new Disassembler());
|
||||||
|
serviceProvider.Register<ITraceable>(Tracer);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEmulatorServiceProvider ServiceProvider { get; private set; }
|
public IEmulatorServiceProvider ServiceProvider { get; private set; }
|
||||||
|
@ -70,9 +67,16 @@ namespace BizHawk.Emulation.Cores.ColecoVision
|
||||||
|
|
||||||
public void FrameAdvance(bool render, bool renderSound)
|
public void FrameAdvance(bool render, bool renderSound)
|
||||||
{
|
{
|
||||||
|
Cpu.Debug = Tracer.Enabled;
|
||||||
Frame++;
|
Frame++;
|
||||||
_isLag = true;
|
_isLag = true;
|
||||||
PSG.BeginFrame(Cpu.TotalExecutedCycles);
|
PSG.BeginFrame(Cpu.TotalExecutedCycles);
|
||||||
|
|
||||||
|
if (Cpu.Debug && Cpu.Logger == null) // TODO, lets not do this on each frame. But lets refactor CoreComm/CoreComm first
|
||||||
|
{
|
||||||
|
Cpu.Logger = (s) => Tracer.Put(s);
|
||||||
|
}
|
||||||
|
|
||||||
VDP.ExecuteFrame();
|
VDP.ExecuteFrame();
|
||||||
PSG.EndFrame(Cpu.TotalExecutedCycles);
|
PSG.EndFrame(Cpu.TotalExecutedCycles);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue