diff --git a/BizHawk.Emulation.Cores/BizHawk.Emulation.Cores.csproj b/BizHawk.Emulation.Cores/BizHawk.Emulation.Cores.csproj index 1fb3735028..6d83c6304a 100644 --- a/BizHawk.Emulation.Cores/BizHawk.Emulation.Cores.csproj +++ b/BizHawk.Emulation.Cores/BizHawk.Emulation.Cores.csproj @@ -122,6 +122,12 @@ AppleII.cs + + AppleII.cs + + + AppleII.cs + AppleII.cs diff --git a/BizHawk.Emulation.Cores/Computers/AppleII/AppleII.IDebuggable.cs b/BizHawk.Emulation.Cores/Computers/AppleII/AppleII.IDebuggable.cs new file mode 100644 index 0000000000..8596f894c4 --- /dev/null +++ b/BizHawk.Emulation.Cores/Computers/AppleII/AppleII.IDebuggable.cs @@ -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 GetCpuFlagsAndRegisters() + { + var regs = _machine.GetCpuFlagsAndRegisters(); + + var dic = new Dictionary(); + + 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(); } + } + } +} diff --git a/BizHawk.Emulation.Cores/Computers/AppleII/AppleII.IDisassembler.cs b/BizHawk.Emulation.Cores/Computers/AppleII/AppleII.IDisassembler.cs new file mode 100644 index 0000000000..2766a460e1 --- /dev/null +++ b/BizHawk.Emulation.Cores/Computers/AppleII/AppleII.IDisassembler.cs @@ -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 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)); + } + } +} diff --git a/ExternalCoreProjects/Virtu/Cpu.cs b/ExternalCoreProjects/Virtu/Cpu.cs index 8ade774953..e6258a81e8 100644 --- a/ExternalCoreProjects/Virtu/Cpu.cs +++ b/ExternalCoreProjects/Virtu/Cpu.cs @@ -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; + + /// Carry Flag + [JsonIgnore] + public bool FlagC + { + get { return (RP & 0x01) != 0; } + private set { RP = (byte)((RP & ~0x01) | (value ? 0x01 : 0x00)); } + } + + /// Zero Flag + [JsonIgnore] + public bool FlagZ + { + get { return (RP & 0x02) != 0; } + private set { RP = (byte)((RP & ~0x02) | (value ? 0x02 : 0x00)); } + } + + /// Interrupt Disable Flag + [JsonIgnore] + public bool FlagI + { + get { return (RP & 0x04) != 0; } + set { RP = (byte)((RP & ~0x04) | (value ? 0x04 : 0x00)); } + } + + /// Decimal Mode Flag + [JsonIgnore] + public bool FlagD + { + get { return (RP & 0x08) != 0; } + private set { RP = (byte)((RP & ~0x08) | (value ? 0x08 : 0x00)); } + } + + /// Break Flag + [JsonIgnore] + public bool FlagB + { + get { return (RP & 0x10) != 0; } + private set { RP = (byte)((RP & ~0x10) | (value ? 0x10 : 0x00)); } + } + + /// T... Flag + [JsonIgnore] + public bool FlagT + { + get { return (RP & 0x20) != 0; } + private set { RP = (byte)((RP & ~0x20) | (value ? 0x20 : 0x00)); } + } + + /// Overflow Flag + [JsonIgnore] + public bool FlagV + { + get { return (RP & 0x40) != 0; } + private set { RP = (byte)((RP & ~0x40) | (value ? 0x40 : 0x00)); } + } + + /// Negative Flag + [JsonIgnore] + public bool FlagN + { + get { return (RP & 0x80) != 0; } + private set { RP = (byte)((RP & ~0x80) | (value ? 0x80 : 0x00)); } + } } } diff --git a/ExternalCoreProjects/Virtu/Machine.cs b/ExternalCoreProjects/Virtu/Machine.cs index c8edc8b609..24c5b64b0f 100644 --- a/ExternalCoreProjects/Virtu/Machine.cs +++ b/ExternalCoreProjects/Virtu/Machine.cs @@ -192,5 +192,25 @@ namespace Jellyfish.Virtu public bool Lagged { get; set; } public bool DriveLight { get; set; } + + public IDictionary GetCpuFlagsAndRegisters() + { + return new Dictionary + { + { "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 } + }; + } } } diff --git a/References/Virtu.dll b/References/Virtu.dll index 551599af81..0919675fee 100644 Binary files a/References/Virtu.dll and b/References/Virtu.dll differ