GBLink 1,3,4 -> Implement Get/SetCpuFlagsAndRegisters, underlying GBHawk doesn't yet have it though so this technically does nothing

This commit is contained in:
adelikat 2020-02-18 14:08:23 -06:00
parent 8fbd375fd5
commit a751aab744
3 changed files with 63 additions and 120 deletions

View File

@ -1,6 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using BizHawk.Emulation.Common; using BizHawk.Emulation.Common;
namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink
@ -9,50 +9,24 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink
{ {
public IDictionary<string, RegisterValue> GetCpuFlagsAndRegisters() public IDictionary<string, RegisterValue> GetCpuFlagsAndRegisters()
{ {
return new Dictionary<string, RegisterValue> var left = L.GetCpuFlagsAndRegisters()
{ .Select(reg => new KeyValuePair<string, RegisterValue>("Left " + reg.Key, reg.Value));
/*
["A"] = cpu.A, var right = R.GetCpuFlagsAndRegisters()
["X"] = cpu.X, .Select(reg => new KeyValuePair<string, RegisterValue>("Right " + reg.Key, reg.Value));
["Y"] = cpu.Y,
["S"] = cpu.S, return left.Union(right).ToDictionary(pair => pair.Key, pair => pair.Value);
["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
*/
};
} }
public void SetCpuRegister(string register, int value) public void SetCpuRegister(string register, int value)
{ {
switch (register) if (register.StartsWith("Left "))
{ {
default: L.SetCpuRegister(register.Replace("Left ", ""), value);
throw new InvalidOperationException(); }
case "A": else if (register.StartsWith("Right "))
//cpu.A = (byte)value; {
break; R.SetCpuRegister(register.Replace("Right ", ""), value);
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,6 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using BizHawk.Emulation.Common; using BizHawk.Emulation.Common;
namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink3x namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink3x
@ -9,50 +9,31 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink3x
{ {
public IDictionary<string, RegisterValue> GetCpuFlagsAndRegisters() public IDictionary<string, RegisterValue> GetCpuFlagsAndRegisters()
{ {
return new Dictionary<string, RegisterValue> var left = L.GetCpuFlagsAndRegisters()
{ .Select(reg => new KeyValuePair<string, RegisterValue>("Left " + reg.Key, reg.Value));
/*
["A"] = cpu.A, var center = C.GetCpuFlagsAndRegisters()
["X"] = cpu.X, .Select(reg => new KeyValuePair<string, RegisterValue>("Center " + reg.Key, reg.Value));
["Y"] = cpu.Y,
["S"] = cpu.S, var right = R.GetCpuFlagsAndRegisters()
["PC"] = cpu.PC, .Select(reg => new KeyValuePair<string, RegisterValue>("Right " + reg.Key, reg.Value));
["Flag C"] = cpu.FlagC,
["Flag Z"] = cpu.FlagZ, return left.Union(center).Union(right).ToDictionary(pair => pair.Key, pair => pair.Value);
["Flag I"] = cpu.FlagI,
["Flag D"] = cpu.FlagD,
["Flag B"] = cpu.FlagB,
["Flag V"] = cpu.FlagV,
["Flag N"] = cpu.FlagN,
["Flag T"] = cpu.FlagT
*/
};
} }
public void SetCpuRegister(string register, int value) public void SetCpuRegister(string register, int value)
{ {
switch (register) if (register.StartsWith("Left "))
{ {
default: L.SetCpuRegister(register.Replace("Left ", ""), value);
throw new InvalidOperationException(); }
case "A": else if (register.StartsWith("Center "))
//cpu.A = (byte)value; {
break; C.SetCpuRegister(register.Replace("Center ", ""), value);
case "X": }
//cpu.X = (byte)value; else if (register.StartsWith("Right "))
break; {
case "Y": R.SetCpuRegister(register.Replace("Right ", ""), value);
//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,6 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using BizHawk.Emulation.Common; using BizHawk.Emulation.Common;
namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink4x namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink4x
@ -9,50 +9,38 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink4x
{ {
public IDictionary<string, RegisterValue> GetCpuFlagsAndRegisters() public IDictionary<string, RegisterValue> GetCpuFlagsAndRegisters()
{ {
return new Dictionary<string, RegisterValue> var a = A.GetCpuFlagsAndRegisters()
{ .Select(reg => new KeyValuePair<string, RegisterValue>("A " + reg.Key, reg.Value));
/*
["A"] = cpu.A, var b = B.GetCpuFlagsAndRegisters()
["X"] = cpu.X, .Select(reg => new KeyValuePair<string, RegisterValue>("B " + reg.Key, reg.Value));
["Y"] = cpu.Y,
["S"] = cpu.S, var c = C.GetCpuFlagsAndRegisters()
["PC"] = cpu.PC, .Select(reg => new KeyValuePair<string, RegisterValue>("C " + reg.Key, reg.Value));
["Flag C"] = cpu.FlagC,
["Flag Z"] = cpu.FlagZ, var d = D.GetCpuFlagsAndRegisters()
["Flag I"] = cpu.FlagI, .Select(reg => new KeyValuePair<string, RegisterValue>("D " + reg.Key, reg.Value));
["Flag D"] = cpu.FlagD,
["Flag B"] = cpu.FlagB, return a.Union(b).Union(c).Union(d).ToDictionary(pair => pair.Key, pair => pair.Value);
["Flag V"] = cpu.FlagV,
["Flag N"] = cpu.FlagN,
["Flag T"] = cpu.FlagT
*/
};
} }
public void SetCpuRegister(string register, int value) public void SetCpuRegister(string register, int value)
{ {
switch (register) if (register.StartsWith("A "))
{ {
default: A.SetCpuRegister(register.Replace("A ", ""), value);
throw new InvalidOperationException(); }
case "A": else if (register.StartsWith("B "))
//cpu.A = (byte)value; {
break; B.SetCpuRegister(register.Replace("B ", ""), value);
case "X": }
//cpu.X = (byte)value; else if (register.StartsWith("C "))
break; {
case "Y": C.SetCpuRegister(register.Replace("C ", ""), value);
//cpu.Y = (byte)value; }
break; else if (register.StartsWith("D "))
case "S": {
//cpu.S = (byte)value; C.SetCpuRegister(register.Replace("D ", ""), value);
break;
case "PC":
//cpu.PC = (ushort)value;
break;
case "Flag I":
//cpu.FlagI = value > 0;
break;
} }
} }