Intellivision - partially implement IDebuggable - flag/register getting and setting, and TotalExecutedCycles

This commit is contained in:
adelikat 2017-04-23 11:46:37 -05:00
parent 432cbc54d7
commit d03577ade6
4 changed files with 108 additions and 3 deletions

View File

@ -412,6 +412,9 @@
<Compile Include="Consoles\Intellivision\Controllers\IntellivisionControllerDeck.cs" />
<Compile Include="Consoles\Intellivision\ICart.cs" />
<Compile Include="Consoles\Intellivision\Intellicart.cs" />
<Compile Include="Consoles\Intellivision\Intellivision.IDebuggable.cs">
<DependentUpon>Intellivision.cs</DependentUpon>
</Compile>
<Compile Include="Consoles\Intellivision\Intellivision.IInputPollable.cs">
<DependentUpon>Intellivision.cs</DependentUpon>
</Compile>

View File

@ -10,9 +10,9 @@ namespace BizHawk.Emulation.Cores.Components.CP1610
private const ushort RESET = 0x1000;
private const ushort INTERRUPT = 0x1004;
private bool FlagS, FlagC, FlagZ, FlagO, FlagI, FlagD, IntRM, BusRq, BusAk, Interruptible, Interrupted;
internal bool FlagS, FlagC, FlagZ, FlagO, FlagI, FlagD, IntRM, BusRq, BusAk, Interruptible, Interrupted;
//private bool MSync;
private ushort[] Register = new ushort[8];
internal ushort[] Register = new ushort[8];
private ushort RegisterSP { get { return Register[6]; } set { Register[6] = value; } }
private ushort RegisterPC { get { return Register[7]; } set { Register[7] = value; } }

View File

@ -0,0 +1,101 @@
using System;
using System.Collections.Generic;
using BizHawk.Emulation.Common;
namespace BizHawk.Emulation.Cores.Intellivision
{
public partial class Intellivision : IDebuggable
{
public IDictionary<string, RegisterValue> GetCpuFlagsAndRegisters()
{
return new Dictionary<string, RegisterValue>
{
["R0"] = _cpu.Register[0],
["R1"] = _cpu.Register[1],
["R2"] = _cpu.Register[2],
["R3"] = _cpu.Register[3],
["R4"] = _cpu.Register[4],
["R5"] = _cpu.Register[5],
["R6"] = _cpu.Register[6],
["R7"] = _cpu.Register[7],
["FlagS"] = _cpu.FlagS ? 1 : 0,
["FlagC"] = _cpu.FlagC ? 1 : 0,
["FlagZ"] = _cpu.FlagZ ? 1 : 0,
["FlagO"] = _cpu.FlagO ? 1 : 0,
["FlagI"] = _cpu.FlagI ? 1 : 0,
["FlagD"] = _cpu.FlagD ? 1 : 0,
};
}
public void SetCpuRegister(string register, int value)
{
switch (register)
{
default:
throw new InvalidOperationException();
case "R0":
_cpu.Register[0] = (ushort)value;
break;
case "R1":
_cpu.Register[1] = (ushort)value;
break;
case "R2":
_cpu.Register[2] = (ushort)value;
break;
case "R3":
_cpu.Register[3] = (ushort)value;
break;
case "R4":
_cpu.Register[4] = (ushort)value;
break;
case "R5":
_cpu.Register[5] = (ushort)value;
break;
case "R6":
_cpu.Register[6] = (ushort)value;
break;
case "R7":
_cpu.Register[7] = (ushort)value;
break;
case "FlagS":
_cpu.FlagS = value > 0;
break;
case "FlagC":
_cpu.FlagC = value > 0;
break;
case "FlagZ":
_cpu.FlagZ = value > 0;
break;
case "FlagO":
_cpu.FlagO = value > 0;
break;
case "FlagI":
_cpu.FlagI = value > 0;
break;
case "FlagD":
_cpu.FlagD = value > 0;
break;
}
}
[FeatureNotImplemented]
public IMemoryCallbackSystem MemoryCallbacks { get { throw new NotImplementedException(); } }
public bool CanStep(StepType type)
{
return false;
}
[FeatureNotImplemented]
public void Step(StepType type)
{
throw new NotImplementedException();
}
public int TotalExecutedCycles => _cpu.TotalExecutedCycles;
}
}

View File

@ -12,7 +12,8 @@ namespace BizHawk.Emulation.Cores.Intellivision
isReleased: true
)]
[ServiceNotApplicable(typeof(ISaveRam), typeof(IDriveLight), typeof(IRegionable))]
public sealed partial class Intellivision : IEmulator, IStatable, IInputPollable, ISettable<Intellivision.IntvSettings, Intellivision.IntvSyncSettings>
public sealed partial class Intellivision : IEmulator, IStatable, IInputPollable,
IDebuggable, ISettable<Intellivision.IntvSettings, Intellivision.IntvSyncSettings>
{
[CoreConstructor("INTV")]
public Intellivision(CoreComm comm, GameInfo game, byte[] rom, object Settings, object SyncSettings)