move get/set cpu registers logic from O2Hawk to Intel8048
This commit is contained in:
parent
cdcc1eabde
commit
8e261a7ddb
|
@ -1,3 +1,7 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using BizHawk.Emulation.Common;
|
||||||
|
|
||||||
namespace BizHawk.Emulation.Cores.Components.I8048
|
namespace BizHawk.Emulation.Cores.Components.I8048
|
||||||
{
|
{
|
||||||
public partial class I8048
|
public partial class I8048
|
||||||
|
@ -100,6 +104,86 @@ namespace BizHawk.Emulation.Cores.Components.I8048
|
||||||
set => Regs[PSW] = (byte)((Regs[PSW] & ~0x80) | (value ? 0x80 : 0x00));
|
set => Regs[PSW] = (byte)((Regs[PSW] & ~0x80) | (value ? 0x80 : 0x00));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IDictionary<string, RegisterValue> GetCpuFlagsAndRegisters()
|
||||||
|
{
|
||||||
|
return new Dictionary<string, RegisterValue>
|
||||||
|
{
|
||||||
|
["R0"] = Regs[0 + RB],
|
||||||
|
["R1"] = Regs[1 + RB],
|
||||||
|
["R2"] = Regs[2 + RB],
|
||||||
|
["R3"] = Regs[3 + RB],
|
||||||
|
["R4"] = Regs[4 + RB],
|
||||||
|
["R5"] = Regs[5 + RB],
|
||||||
|
["R6"] = Regs[6 + RB],
|
||||||
|
["R7"] = Regs[7 + RB],
|
||||||
|
["PC"] = Regs[PC],
|
||||||
|
["Flag C"] = FlagC,
|
||||||
|
["Flag AC"] = FlagAC,
|
||||||
|
["Flag BS"] = FlagBS,
|
||||||
|
["Flag F0"] = FlagF0,
|
||||||
|
["Flag F1"] = F1,
|
||||||
|
["Flag T0"] = T0,
|
||||||
|
["Flag T1"] = T1
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetCpuRegister(string register, int value)
|
||||||
|
{
|
||||||
|
switch (register)
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
throw new InvalidOperationException();
|
||||||
|
case "R0":
|
||||||
|
Regs[0 + RB] = (byte)value;
|
||||||
|
break;
|
||||||
|
case "R1":
|
||||||
|
Regs[1 + RB] = (byte)value;
|
||||||
|
break;
|
||||||
|
case "R2":
|
||||||
|
Regs[2 + RB] = (byte)value;
|
||||||
|
break;
|
||||||
|
case "R3":
|
||||||
|
Regs[3 + RB] = (byte)value;
|
||||||
|
break;
|
||||||
|
case "R4":
|
||||||
|
Regs[4 + RB] = (byte)value;
|
||||||
|
break;
|
||||||
|
case "R5":
|
||||||
|
Regs[5 + RB] = (byte)value;
|
||||||
|
break;
|
||||||
|
case "R6":
|
||||||
|
Regs[6 + RB] = (byte)value;
|
||||||
|
break;
|
||||||
|
case "R7":
|
||||||
|
Regs[7 + RB] = (byte)value;
|
||||||
|
break;
|
||||||
|
case "PC":
|
||||||
|
Regs[PC] = (ushort)value;
|
||||||
|
break;
|
||||||
|
case "Flag C":
|
||||||
|
FlagC = value > 0;
|
||||||
|
break;
|
||||||
|
case "Flag AC":
|
||||||
|
FlagAC = value > 0;
|
||||||
|
break;
|
||||||
|
case "Flag BS":
|
||||||
|
FlagBS = value > 0;
|
||||||
|
break;
|
||||||
|
case "Flag F0":
|
||||||
|
FlagF0 = value > 0;
|
||||||
|
break;
|
||||||
|
case "Flag F1":
|
||||||
|
F1 = value > 0;
|
||||||
|
break;
|
||||||
|
case "Flag T0":
|
||||||
|
T0 = value > 0;
|
||||||
|
break;
|
||||||
|
case "Flag T1":
|
||||||
|
T1 = value > 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void ResetRegisters()
|
private void ResetRegisters()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 78; i++)
|
for (int i = 0; i < 78; i++)
|
||||||
|
|
|
@ -1,102 +1,23 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
using BizHawk.Emulation.Common;
|
using BizHawk.Emulation.Common;
|
||||||
using BizHawk.Emulation.Cores.Components.I8048;
|
|
||||||
|
|
||||||
namespace BizHawk.Emulation.Cores.Consoles.O2Hawk
|
namespace BizHawk.Emulation.Cores.Consoles.O2Hawk
|
||||||
{
|
{
|
||||||
public partial class O2Hawk : IDebuggable
|
public partial class O2Hawk : IDebuggable
|
||||||
{
|
{
|
||||||
public IDictionary<string, RegisterValue> GetCpuFlagsAndRegisters()
|
public IDictionary<string, RegisterValue> GetCpuFlagsAndRegisters()
|
||||||
{
|
=> cpu.GetCpuFlagsAndRegisters();
|
||||||
return new Dictionary<string, RegisterValue>
|
|
||||||
{
|
|
||||||
["R0"] = cpu.Regs[0 + cpu.RB],
|
|
||||||
["R1"] = cpu.Regs[1 + cpu.RB],
|
|
||||||
["R2"] = cpu.Regs[2 + cpu.RB],
|
|
||||||
["R3"] = cpu.Regs[3 + cpu.RB],
|
|
||||||
["R4"] = cpu.Regs[4 + cpu.RB],
|
|
||||||
["R5"] = cpu.Regs[5 + cpu.RB],
|
|
||||||
["R6"] = cpu.Regs[6 + cpu.RB],
|
|
||||||
["R7"] = cpu.Regs[7 + cpu.RB],
|
|
||||||
["PC"] = cpu.Regs[I8048.PC],
|
|
||||||
["Flag C"] = cpu.FlagC,
|
|
||||||
["Flag AC"] = cpu.FlagAC,
|
|
||||||
["Flag BS"] = cpu.FlagBS,
|
|
||||||
["Flag F0"] = cpu.FlagF0,
|
|
||||||
["Flag F1"] = cpu.F1,
|
|
||||||
["Flag T0"] = cpu.T0,
|
|
||||||
["Flag T1"] = cpu.T1
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SetCpuRegister(string register, int value)
|
public void SetCpuRegister(string register, int value)
|
||||||
{
|
=> cpu.SetCpuRegister(register, value);
|
||||||
switch (register)
|
|
||||||
{
|
|
||||||
default:
|
|
||||||
throw new InvalidOperationException();
|
|
||||||
case "R0":
|
|
||||||
cpu.Regs[0 + cpu.RB] = (byte)value;
|
|
||||||
break;
|
|
||||||
case "R1":
|
|
||||||
cpu.Regs[1 + cpu.RB] = (byte)value;
|
|
||||||
break;
|
|
||||||
case "R2":
|
|
||||||
cpu.Regs[2 + cpu.RB] = (byte)value;
|
|
||||||
break;
|
|
||||||
case "R3":
|
|
||||||
cpu.Regs[3 + cpu.RB] = (byte)value;
|
|
||||||
break;
|
|
||||||
case "R4":
|
|
||||||
cpu.Regs[4 + cpu.RB] = (byte)value;
|
|
||||||
break;
|
|
||||||
case "R5":
|
|
||||||
cpu.Regs[5 + cpu.RB] = (byte)value;
|
|
||||||
break;
|
|
||||||
case "R6":
|
|
||||||
cpu.Regs[6 + cpu.RB] = (byte)value;
|
|
||||||
break;
|
|
||||||
case "R7":
|
|
||||||
cpu.Regs[7 + cpu.RB] = (byte)value;
|
|
||||||
break;
|
|
||||||
case "PC":
|
|
||||||
cpu.Regs[I8048.PC] = (ushort)value;
|
|
||||||
break;
|
|
||||||
case "Flag C":
|
|
||||||
cpu.FlagC = value > 0;
|
|
||||||
break;
|
|
||||||
case "Flag AC":
|
|
||||||
cpu.FlagAC = value > 0;
|
|
||||||
break;
|
|
||||||
case "Flag BS":
|
|
||||||
cpu.FlagBS = value > 0;
|
|
||||||
break;
|
|
||||||
case "Flag F0":
|
|
||||||
cpu.FlagF0 = value > 0;
|
|
||||||
break;
|
|
||||||
case "Flag F1":
|
|
||||||
cpu.F1 = value > 0;
|
|
||||||
break;
|
|
||||||
case "Flag T0":
|
|
||||||
cpu.T0 = value > 0;
|
|
||||||
break;
|
|
||||||
case "Flag T1":
|
|
||||||
cpu.T1 = value > 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public IMemoryCallbackSystem MemoryCallbacks { get; } = new MemoryCallbackSystem(new[] { "System Bus" });
|
public IMemoryCallbackSystem MemoryCallbacks { get; } = new MemoryCallbackSystem(new[] { "System Bus" });
|
||||||
|
|
||||||
public bool CanStep(StepType type) => false;
|
public bool CanStep(StepType type) => false;
|
||||||
|
|
||||||
[FeatureNotImplemented]
|
[FeatureNotImplemented]
|
||||||
public void Step(StepType type)
|
public void Step(StepType type) => throw new NotImplementedException();
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public long TotalExecutedCycles => (long)cpu.TotalExecutedCycles;
|
public long TotalExecutedCycles => (long)cpu.TotalExecutedCycles;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue