Apple II - implement IDisassembler, and IDebuggable.GetCpuFlagsAndRegisters()
This commit is contained in:
parent
71f23f4886
commit
a99c0787a8
|
@ -122,6 +122,12 @@
|
|||
<Compile Include="Computers\AppleII\AppleII.IAudioProvider.cs">
|
||||
<DependentUpon>AppleII.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Computers\AppleII\AppleII.IDebuggable.cs">
|
||||
<DependentUpon>AppleII.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Computers\AppleII\AppleII.IDisassembler.cs">
|
||||
<DependentUpon>AppleII.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Computers\AppleII\AppleII.IEmulator.cs">
|
||||
<DependentUpon>AppleII.cs</DependentUpon>
|
||||
</Compile>
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Emulation.Cores.Computers.AppleII
|
||||
{
|
||||
public partial class AppleII : IDebuggable
|
||||
{
|
||||
[FeatureNotImplemented]
|
||||
public IDictionary<string, RegisterValue> GetCpuFlagsAndRegisters()
|
||||
{
|
||||
var regs = _machine.GetCpuFlagsAndRegisters();
|
||||
|
||||
var dic = new Dictionary<string, RegisterValue>();
|
||||
|
||||
foreach (var reg in regs)
|
||||
{
|
||||
dic.Add(
|
||||
reg.Key,
|
||||
reg.Key.Contains("Flag")
|
||||
? reg.Value > 0
|
||||
: (RegisterValue)reg.Value);
|
||||
}
|
||||
|
||||
return dic;
|
||||
}
|
||||
|
||||
[FeatureNotImplemented]
|
||||
public void SetCpuRegister(string register, int value)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public bool CanStep(StepType type) { return false; }
|
||||
|
||||
[FeatureNotImplemented]
|
||||
public void Step(StepType type) { throw new NotImplementedException(); }
|
||||
|
||||
public IMemoryCallbackSystem MemoryCallbacks
|
||||
{
|
||||
[FeatureNotImplemented]
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
using BizHawk.Emulation.Common;
|
||||
using BizHawk.Emulation.Cores.Components.M6502;
|
||||
|
||||
namespace BizHawk.Emulation.Cores.Computers.AppleII
|
||||
{
|
||||
public partial class AppleII : IDisassemblable
|
||||
{
|
||||
public string Cpu
|
||||
{
|
||||
get
|
||||
{
|
||||
return "6502";
|
||||
}
|
||||
set
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public string PCRegisterName
|
||||
{
|
||||
get { return "PC"; }
|
||||
}
|
||||
|
||||
public IEnumerable<string> AvailableCpus
|
||||
{
|
||||
get { yield return "6502"; }
|
||||
}
|
||||
|
||||
public string Disassemble(MemoryDomain m, uint addr, out int length)
|
||||
{
|
||||
return MOS6502X.Disassemble((ushort)addr, out length, (a) => m.PeekByte(a));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -2,6 +2,7 @@
|
|||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Jellyfish.Virtu
|
||||
{
|
||||
|
@ -3200,7 +3201,7 @@ namespace Jellyfish.Virtu
|
|||
}
|
||||
#endregion
|
||||
|
||||
[Newtonsoft.Json.JsonIgnore]
|
||||
[JsonIgnore]
|
||||
public bool Is65C02 { get { return _is65C02; } set { _is65C02 = value; _executeOpCode = _is65C02 ? ExecuteOpCode65C02 : ExecuteOpCode65N02; } }
|
||||
public bool IsThrottled { get; set; }
|
||||
public int Multiplier { get; set; }
|
||||
|
@ -3220,5 +3221,69 @@ namespace Jellyfish.Virtu
|
|||
|
||||
private bool _is65C02;
|
||||
private Action[] _executeOpCode;
|
||||
|
||||
/// <summary>Carry Flag</summary>
|
||||
[JsonIgnore]
|
||||
public bool FlagC
|
||||
{
|
||||
get { return (RP & 0x01) != 0; }
|
||||
private set { RP = (byte)((RP & ~0x01) | (value ? 0x01 : 0x00)); }
|
||||
}
|
||||
|
||||
/// <summary>Zero Flag</summary>
|
||||
[JsonIgnore]
|
||||
public bool FlagZ
|
||||
{
|
||||
get { return (RP & 0x02) != 0; }
|
||||
private set { RP = (byte)((RP & ~0x02) | (value ? 0x02 : 0x00)); }
|
||||
}
|
||||
|
||||
/// <summary>Interrupt Disable Flag</summary>
|
||||
[JsonIgnore]
|
||||
public bool FlagI
|
||||
{
|
||||
get { return (RP & 0x04) != 0; }
|
||||
set { RP = (byte)((RP & ~0x04) | (value ? 0x04 : 0x00)); }
|
||||
}
|
||||
|
||||
/// <summary>Decimal Mode Flag</summary>
|
||||
[JsonIgnore]
|
||||
public bool FlagD
|
||||
{
|
||||
get { return (RP & 0x08) != 0; }
|
||||
private set { RP = (byte)((RP & ~0x08) | (value ? 0x08 : 0x00)); }
|
||||
}
|
||||
|
||||
/// <summary>Break Flag</summary>
|
||||
[JsonIgnore]
|
||||
public bool FlagB
|
||||
{
|
||||
get { return (RP & 0x10) != 0; }
|
||||
private set { RP = (byte)((RP & ~0x10) | (value ? 0x10 : 0x00)); }
|
||||
}
|
||||
|
||||
/// <summary>T... Flag</summary>
|
||||
[JsonIgnore]
|
||||
public bool FlagT
|
||||
{
|
||||
get { return (RP & 0x20) != 0; }
|
||||
private set { RP = (byte)((RP & ~0x20) | (value ? 0x20 : 0x00)); }
|
||||
}
|
||||
|
||||
/// <summary>Overflow Flag</summary>
|
||||
[JsonIgnore]
|
||||
public bool FlagV
|
||||
{
|
||||
get { return (RP & 0x40) != 0; }
|
||||
private set { RP = (byte)((RP & ~0x40) | (value ? 0x40 : 0x00)); }
|
||||
}
|
||||
|
||||
/// <summary>Negative Flag</summary>
|
||||
[JsonIgnore]
|
||||
public bool FlagN
|
||||
{
|
||||
get { return (RP & 0x80) != 0; }
|
||||
private set { RP = (byte)((RP & ~0x80) | (value ? 0x80 : 0x00)); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -192,5 +192,25 @@ namespace Jellyfish.Virtu
|
|||
|
||||
public bool Lagged { get; set; }
|
||||
public bool DriveLight { get; set; }
|
||||
|
||||
public IDictionary<string, int> GetCpuFlagsAndRegisters()
|
||||
{
|
||||
return new Dictionary<string, int>
|
||||
{
|
||||
{ "A", Cpu.RA },
|
||||
{ "X", Cpu.RX },
|
||||
{ "Y", Cpu.RY },
|
||||
{ "S", Cpu.RS },
|
||||
{ "PC", Cpu.RPC },
|
||||
{ "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 }
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue