2017-05-08 16:29:09 +00:00
|
|
|
|
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;
|
2017-10-06 14:51:40 +00:00
|
|
|
|
|
|
|
|
|
// 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++;
|
2017-05-08 16:29:09 +00:00
|
|
|
|
_isLag = true;
|
2017-05-08 16:37:16 +00:00
|
|
|
|
PSG.BeginFrame(_cpu.TotalExecutedCycles);
|
2017-05-08 16:29:09 +00:00
|
|
|
|
|
2017-10-13 21:50:54 +00:00
|
|
|
|
if (_tracer.Enabled)
|
2017-05-08 16:29:09 +00:00
|
|
|
|
{
|
2017-10-13 21:50:54 +00:00
|
|
|
|
_cpu.TraceCallback = s => _tracer.Put(s);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
_cpu.TraceCallback = null;
|
2017-05-08 16:29:09 +00:00
|
|
|
|
}
|
|
|
|
|
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:29:09 +00:00
|
|
|
|
|
2017-05-08 16:37:16 +00:00
|
|
|
|
PSG.EndFrame(_cpu.TotalExecutedCycles);
|
2017-05-08 16:29:09 +00:00
|
|
|
|
|
|
|
|
|
if (_isLag)
|
|
|
|
|
{
|
|
|
|
|
_lagCount++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-08 16:37:16 +00:00
|
|
|
|
public int Frame => _frame;
|
2017-05-08 16:29:09 +00:00
|
|
|
|
|
|
|
|
|
public string SystemId => "Coleco";
|
|
|
|
|
|
|
|
|
|
public bool DeterministicEmulation => true;
|
|
|
|
|
|
|
|
|
|
public void ResetCounters()
|
|
|
|
|
{
|
2017-05-08 16:37:16 +00:00
|
|
|
|
_frame = 0;
|
2017-05-08 16:29:09 +00:00
|
|
|
|
_lagCount = 0;
|
|
|
|
|
_isLag = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public CoreComm CoreComm { get; }
|
|
|
|
|
|
|
|
|
|
public void Dispose()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|