Atari 2600 - break off IDebuggable stuff to its own file

This commit is contained in:
adelikat 2014-11-23 17:14:40 +00:00
parent c61dd6b295
commit 4d3e7f806f
4 changed files with 68 additions and 51 deletions

View File

@ -145,9 +145,10 @@
<Compile Include="Computers\Commodore64\UserPort\UserPortDevice.cs" />
<Compile Include="Consoles\Atari\2600\Atari2600.cs" />
<Compile Include="Consoles\Atari\2600\Atari2600.Core.cs" />
<Compile Include="Consoles\Atari\2600\Atari2600.IDebuggable.cs" />
<Compile Include="Consoles\Atari\2600\Atari2600.IMemoryDomains.cs" />
<Compile Include="Consoles\Atari\2600\Atari2600.ISettable.cs" />
<Compile Include="Consoles\Atari\2600\Atari2600.RomHeuristics.cs" />
<Compile Include="Consoles\Atari\2600\Atari2600.Settings.cs" />
<Compile Include="Consoles\Atari\2600\Mappers\m0840.cs" />
<Compile Include="Consoles\Atari\2600\Mappers\m3E.cs" />
<Compile Include="Consoles\Atari\2600\Mappers\m3F.cs" />

View File

@ -0,0 +1,59 @@
using System;
using System.Collections.Generic;
using BizHawk.Emulation.Common;
namespace BizHawk.Emulation.Cores.Atari.Atari2600
{
public partial class Atari2600 : IDebuggable
{
public IDictionary<string, int> GetCpuFlagsAndRegisters()
{
return new Dictionary<string, int>
{
{ "A", Cpu.A },
{ "X", Cpu.X },
{ "Y", Cpu.Y },
{ "S", Cpu.S },
{ "PC", Cpu.PC },
{ "Flag C", Cpu.FlagC ? 1 : 0 },
{ "Flag Z", Cpu.FlagZ ? 1 : 0 },
{ "Flag I", Cpu.FlagI ? 1 : 0 },
{ "Flag D", Cpu.FlagD ? 1 : 0 },
{ "Flag B", Cpu.FlagB ? 1 : 0 },
{ "Flag V", Cpu.FlagV ? 1 : 0 },
{ "Flag N", Cpu.FlagN ? 1 : 0 },
{ "Flag T", Cpu.FlagT ? 1 : 0 }
};
}
public void SetCpuRegister(string register, int value)
{
switch (register)
{
default:
throw new InvalidOperationException();
case "A":
Cpu.A = (byte)value;
break;
case "X":
Cpu.X = (byte)value;
break;
case "Y":
Cpu.Y = (byte)value;
break;
case "S":
Cpu.S = (byte)value;
break;
case "PC":
Cpu.PC = (ushort)value;
break;
case "Flag I":
Cpu.FlagI = value > 0;
break;
}
}
}
}

View File

@ -1,8 +1,10 @@
using System;
using System.ComponentModel;
using System.Drawing;
using BizHawk.Emulation.Common;
using Newtonsoft.Json;
using BizHawk.Emulation.Common;
using BizHawk.Common;
namespace BizHawk.Emulation.Cores.Atari.Atari2600
@ -24,7 +26,9 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
if (Settings == null || Settings.SECAMColors != o.SECAMColors)
{
if (_tia != null)
{
_tia.SetSECAM(o.SECAMColors);
}
}
Settings = o;

View File

@ -15,7 +15,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
isPorted: false,
isReleased: true
)]
public partial class Atari2600 : IEmulator, IMemoryDomains, IDebuggable
public partial class Atari2600 : IEmulator, IMemoryDomains, IDebuggable, ISettable<Atari2600.A2600Settings, Atari2600.A2600SyncSettings>
{
private readonly GameInfo _game;
private bool _islag = true;
@ -122,54 +122,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
};
}
public IDictionary<string, int> GetCpuFlagsAndRegisters()
{
return new Dictionary<string, int>
{
{ "A", Cpu.A },
{ "X", Cpu.X },
{ "Y", Cpu.Y },
{ "S", Cpu.S },
{ "PC", Cpu.PC },
{ "Flag C", Cpu.FlagC ? 1 : 0 },
{ "Flag Z", Cpu.FlagZ ? 1 : 0 },
{ "Flag I", Cpu.FlagI ? 1 : 0 },
{ "Flag D", Cpu.FlagD ? 1 : 0 },
{ "Flag B", Cpu.FlagB ? 1 : 0 },
{ "Flag V", Cpu.FlagV ? 1 : 0 },
{ "Flag N", Cpu.FlagN ? 1 : 0 },
{ "Flag T", Cpu.FlagT ? 1 : 0 }
};
}
public void SetCpuRegister(string register, int value)
{
switch(register)
{
default:
throw new InvalidOperationException();
case "A":
Cpu.A = (byte)value;
break;
case "X":
Cpu.X = (byte)value;
break;
case "Y":
Cpu.Y = (byte)value;
break;
case "S":
Cpu.S = (byte)value;
break;
case "PC":
Cpu.PC = (ushort)value;
break;
case "Flag I":
Cpu.FlagI = value > 0;
break;
}
}
public bool StartAsyncSound() { return true; }