GBHawk - implement Get/SetCpuFlagsAndRegisters
This commit is contained in:
parent
a751aab744
commit
4e03e14eea
|
@ -1,3 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Emulation.Cores.Components.LR35902
|
||||
{
|
||||
public partial class LR35902
|
||||
|
@ -66,5 +70,85 @@ namespace BizHawk.Emulation.Cores.Components.LR35902
|
|||
}
|
||||
}
|
||||
|
||||
public IDictionary<string, RegisterValue> GetCpuFlagsAndRegisters()
|
||||
{
|
||||
return new Dictionary<string, RegisterValue>
|
||||
{
|
||||
[nameof(PCl)] = Regs[PCl],
|
||||
[nameof(PCh)] = Regs[PCh],
|
||||
[nameof(SPl)] = Regs[SPl],
|
||||
[nameof(SPh)] = Regs[SPh],
|
||||
[nameof(A)] = Regs[A],
|
||||
[nameof(F)] = Regs[F],
|
||||
[nameof(B)] = Regs[B],
|
||||
[nameof(C)] = Regs[C],
|
||||
[nameof(D)] = Regs[D],
|
||||
[nameof(E)] = Regs[E],
|
||||
[nameof(H)] = Regs[H],
|
||||
[nameof(L)] = Regs[L],
|
||||
[nameof(W)] = Regs[W],
|
||||
[nameof(Z)] = Regs[Z],
|
||||
["PC"] = RegPC,
|
||||
["Flag I"] = FlagI,
|
||||
["Flag C"] = FlagC,
|
||||
["Flag H"] = FlagH,
|
||||
["Flag N"] = FlagN,
|
||||
["Flag Z"] = FlagZ
|
||||
};
|
||||
}
|
||||
|
||||
public void SetCpuRegister(string register, int value)
|
||||
{
|
||||
switch (register)
|
||||
{
|
||||
default:
|
||||
throw new InvalidOperationException();
|
||||
case nameof(PCl):
|
||||
Regs[PCl] = (ushort)value;
|
||||
break;
|
||||
case nameof(PCh):
|
||||
Regs[PCh] = (ushort)value;
|
||||
break;
|
||||
case nameof(SPl):
|
||||
Regs[SPl] = (ushort)value;
|
||||
break;
|
||||
case nameof(SPh):
|
||||
Regs[SPh] = (ushort)value;
|
||||
break;
|
||||
case nameof(A):
|
||||
Regs[A] = (ushort)value;
|
||||
break;
|
||||
case nameof(F):
|
||||
Regs[F] = (ushort)value;
|
||||
break;
|
||||
case nameof(B):
|
||||
Regs[B] = (ushort)value;
|
||||
break;
|
||||
case nameof(C):
|
||||
Regs[C] = (ushort)value;
|
||||
break;
|
||||
case nameof(D):
|
||||
Regs[D] = (ushort)value;
|
||||
break;
|
||||
case nameof(E):
|
||||
Regs[E] = (ushort)value;
|
||||
break;
|
||||
case nameof(H):
|
||||
Regs[H] = (ushort)value;
|
||||
break;
|
||||
case nameof(L):
|
||||
Regs[L] = (ushort)value;
|
||||
break;
|
||||
case nameof(W):
|
||||
Regs[W] = (ushort)value;
|
||||
break;
|
||||
case nameof(Z):
|
||||
Regs[Z] = (ushort)value;
|
||||
break;
|
||||
case "PC":
|
||||
RegPC = (ushort) value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,6 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
|
||||
|
@ -8,53 +7,10 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
|
|||
public partial class GBHawk : IDebuggable
|
||||
{
|
||||
public IDictionary<string, RegisterValue> GetCpuFlagsAndRegisters()
|
||||
{
|
||||
return new Dictionary<string, RegisterValue>
|
||||
{
|
||||
/*
|
||||
["A"] = cpu.A,
|
||||
["X"] = cpu.X,
|
||||
["Y"] = cpu.Y,
|
||||
["S"] = cpu.S,
|
||||
["PC"] = cpu.PC,
|
||||
["Flag C"] = cpu.FlagC,
|
||||
["Flag Z"] = cpu.FlagZ,
|
||||
["Flag I"] = cpu.FlagI,
|
||||
["Flag D"] = cpu.FlagD,
|
||||
["Flag B"] = cpu.FlagB,
|
||||
["Flag V"] = cpu.FlagV,
|
||||
["Flag N"] = cpu.FlagN,
|
||||
["Flag T"] = cpu.FlagT
|
||||
*/
|
||||
};
|
||||
}
|
||||
=> cpu.GetCpuFlagsAndRegisters();
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
=> cpu.SetCpuRegister(register, value);
|
||||
|
||||
public IMemoryCallbackSystem MemoryCallbacks { get; } = new MemoryCallbackSystem(new[] { "System Bus" });
|
||||
|
||||
|
|
|
@ -92,6 +92,7 @@
|
|||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=IO/@EntryIndexedValue">IO</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=IPS/@EntryIndexedValue">IPS</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=IRQ/@EntryIndexedValue">IRQ</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=LR/@EntryIndexedValue">LR</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=MGBA/@EntryIndexedValue">MGBA</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=NES/@EntryIndexedValue">NES</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=NMI/@EntryIndexedValue">NMI</s:String>
|
||||
|
@ -376,6 +377,7 @@
|
|||
<s:Boolean x:Key="/Default/UserDictionary/Words/=resizer/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=resync/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Rewinder/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=RLCA/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Roms/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=samp/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=samplerate/@EntryIndexedValue">True</s:Boolean>
|
||||
|
|
Loading…
Reference in New Issue