BizHawk/BizHawk.Emulation.Cores/Consoles/Coleco/ColecoVision.IEmulator.cs

74 lines
1.5 KiB
C#
Raw Normal View History

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;
// NOTE: Need to research differences between reset and power cycle
if (_controller.IsPressed("Power"))
{
HardReset();
}
if (_controller.IsPressed("Reset"))
{
SoftReset();
}
2017-05-08 16:37:16 +00:00
_frame++;
_isLag = true;
2017-05-08 16:37:16 +00:00
PSG.BeginFrame(_cpu.TotalExecutedCycles);
2017-10-13 21:50:54 +00:00
if (_tracer.Enabled)
{
2017-10-13 21:50:54 +00:00
_cpu.TraceCallback = s => _tracer.Put(s);
}
else
{
_cpu.TraceCallback = null;
}
byte tempRet1 = ControllerDeck.ReadPort1(controller, true, true);
byte tempRet2 = ControllerDeck.ReadPort2(controller, true, true);
bool intPending = (!tempRet1.Bit(4)) | (!tempRet2.Bit(4));
2017-05-08 16:37:16 +00:00
_vdp.ExecuteFrame(intPending);
2017-05-08 16:37:16 +00:00
PSG.EndFrame(_cpu.TotalExecutedCycles);
if (_isLag)
{
_lagCount++;
}
}
2017-05-08 16:37:16 +00:00
public int Frame => _frame;
public string SystemId => "Coleco";
public bool DeterministicEmulation => true;
public void ResetCounters()
{
2017-05-08 16:37:16 +00:00
_frame = 0;
_lagCount = 0;
_isLag = false;
}
public CoreComm CoreComm { get; }
public void Dispose()
{
}
}
}