using BizHawk.Emulation.Common; using BizHawk.Common.NumberExtensions; namespace BizHawk.Emulation.Cores.ColecoVision { public partial class ColecoVision : IEmulator { public IEmulatorServiceProvider ServiceProvider { get; } public ControllerDefinition ControllerDefinition => ControllerDeck.Definition; public void FrameAdvance(IController controller, bool render, bool renderSound) { _controller = controller; _cpu.Debug = _tracer.Enabled; _frame++; _isLag = true; 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); } byte tempRet1 = ControllerDeck.ReadPort1(controller, true, true); byte tempRet2 = ControllerDeck.ReadPort2(controller, true, true); bool intPending = (!tempRet1.Bit(4)) | (!tempRet2.Bit(4)); _vdp.ExecuteFrame(intPending); PSG.EndFrame(_cpu.TotalExecutedCycles); if (_isLag) { _lagCount++; } } public int Frame => _frame; public string SystemId => "Coleco"; public bool DeterministicEmulation => true; public void ResetCounters() { _frame = 0; _lagCount = 0; _isLag = false; } public CoreComm CoreComm { get; } public void Dispose() { } } }