BizHawk/BizHawk.Emulation.Cores/Computers/Commodore64/C64.IDebuggable.cs

76 lines
1.9 KiB
C#
Raw Normal View History

2014-12-18 18:39:55 +00:00
using System;
using System.Collections.Generic;
2016-02-22 23:50:11 +00:00
using System.Linq;
2014-12-18 18:39:55 +00:00
using BizHawk.Emulation.Common;
namespace BizHawk.Emulation.Cores.Computers.Commodore64
{
public partial class C64 : IDebuggable
{
2016-02-22 23:50:11 +00:00
[SaveState.DoNotSave] private IDebuggable _selectedDebuggable;
private IEnumerable<IDebuggable> GetAvailableDebuggables()
{
yield return _board.Cpu;
if (_board.DiskDrive != null)
{
yield return _board.DiskDrive;
}
}
private void SetDefaultDebuggable()
{
_selectedDebuggable = GetAvailableDebuggables().First();
}
IDictionary<string, RegisterValue> IDebuggable.GetCpuFlagsAndRegisters()
2014-12-18 18:39:55 +00:00
{
2016-02-22 23:50:11 +00:00
if (_selectedDebuggable == null)
{
SetDefaultDebuggable();
}
return _selectedDebuggable.GetCpuFlagsAndRegisters();
2014-12-18 18:39:55 +00:00
}
2016-02-22 23:50:11 +00:00
void IDebuggable.SetCpuRegister(string register, int value)
2015-09-28 18:53:19 +00:00
{
2016-02-22 23:50:11 +00:00
if (_selectedDebuggable == null)
{
SetDefaultDebuggable();
}
_selectedDebuggable.SetCpuRegister(register, value);
2015-09-28 18:53:19 +00:00
}
2016-02-22 23:50:11 +00:00
bool IDebuggable.CanStep(StepType type)
2015-09-28 18:53:19 +00:00
{
2016-02-22 23:50:11 +00:00
if (_selectedDebuggable == null)
{
SetDefaultDebuggable();
}
return _selectedDebuggable.CanStep(type);
2015-09-28 18:53:19 +00:00
}
2016-02-22 23:50:11 +00:00
void IDebuggable.Step(StepType type)
2015-09-28 18:53:19 +00:00
{
2016-02-22 23:50:11 +00:00
if (_selectedDebuggable == null)
{
SetDefaultDebuggable();
}
_selectedDebuggable.Step(type);
2015-09-28 18:53:19 +00:00
}
[FeatureNotImplemented]
public int TotalExecutedCycles
{
get { return _selectedDebuggable.TotalExecutedCycles; }
}
2016-02-22 23:50:11 +00:00
[SaveState.DoNotSave]
private readonly IMemoryCallbackSystem _memoryCallbacks;
2015-09-28 18:53:19 +00:00
2016-02-22 23:50:11 +00:00
[SaveState.DoNotSave]
IMemoryCallbackSystem IDebuggable.MemoryCallbacks { get { return _memoryCallbacks; } }
2015-09-28 18:53:19 +00:00
}
2014-12-18 18:39:55 +00:00
}