BizHawk/BizHawk.Emulation.Cores/Calculator/TI83.IEmulator.cs

88 lines
1.5 KiB
C#
Raw Normal View History

using BizHawk.Emulation.Common;
namespace BizHawk.Emulation.Cores.Calculators
{
public partial class TI83 : IEmulator
{
2017-05-01 14:10:07 +00:00
public IEmulatorServiceProvider ServiceProvider { get; }
2017-05-01 14:10:07 +00:00
public ControllerDefinition ControllerDefinition => TI83Controller;
public void FrameAdvance(IController controller, bool render, bool rendersound)
{
_controller = controller;
_lagged = true;
2017-10-13 20:26:32 +00:00
if (_tracer.Enabled)
{
_cpu.TraceCallback = s => _tracer.Put(s);
}
else
2017-05-01 14:10:07 +00:00
{
2017-10-13 20:26:32 +00:00
_cpu.TraceCallback = null;
2017-05-01 14:10:07 +00:00
}
2016-02-28 13:07:22 +00:00
_onPressed = controller.IsPressed("ON");
if (_onPressed && ON_key_int_EN && !ON_key_int)
{
ON_key_int = true;
_cpu.FlagI = true;
}
// see: http://wikiti.brandonw.net/index.php?title=83:Ports:04
// for timer interrupt frequency
// CPU frequency is 6MHz
for (int i = 0; i < 100000; i++)
{
_cpu.ExecuteOne();
TIM_count++;
if (TIM_count >= TIM_hit)
2017-10-13 20:26:32 +00:00
{
TIM_count = 0;
2017-10-13 20:26:32 +00:00
if (TIM_1_int_EN)
{
TIM_1_int = true;
_cpu.FlagI = true;
}
}
}
Frame++;
if (_lagged)
{
_lagCount++;
}
_isLag = _lagged;
}
public int Frame
{
get { return _frame; }
2017-05-01 14:10:07 +00:00
private set { _frame = value; }
}
2017-05-01 14:10:07 +00:00
public string SystemId => "TI83";
2017-05-01 14:10:07 +00:00
public bool DeterministicEmulation => true;
2017-05-01 14:10:07 +00:00
public void ResetCounters()
{
Frame = 0;
_lagCount = 0;
_isLag = false;
}
2017-05-01 14:10:07 +00:00
public CoreComm CoreComm { get; }
2017-05-01 14:10:07 +00:00
public void Dispose()
{
}
}
}