SetCpuRegister() - don't cast PC reg to byte! Implement on SMS, Coleco, and TI-83

This commit is contained in:
adelikat 2014-05-31 18:25:36 +00:00
parent 51660dd023
commit 1c0f8674c3
8 changed files with 218 additions and 8 deletions

View File

@ -1049,7 +1049,77 @@ namespace BizHawk.Emulation.Cores.Calculators
public void SetCpuRegister(string register, int value)
{
throw new NotImplementedException();
switch (register)
{
default:
throw new InvalidOperationException();
case "A":
cpu.RegisterA = (byte)value;
break;
case "AF":
cpu.RegisterAF = (byte)value;
break;
case "B":
cpu.RegisterB = (byte)value;
break;
case "BC":
cpu.RegisterBC = (byte)value;
break;
case "C":
cpu.RegisterC = (byte)value;
break;
case "D":
cpu.RegisterD = (byte)value;
break;
case "DE":
cpu.RegisterDE = (byte)value;
break;
case "E":
cpu.RegisterE = (byte)value;
break;
case "F":
cpu.RegisterF = (byte)value;
break;
case "H":
cpu.RegisterH = (byte)value;
break;
case "HL":
cpu.RegisterHL = (byte)value;
break;
case "I":
cpu.RegisterI = (byte)value;
break;
case "IX":
cpu.RegisterIX = (byte)value;
break;
case "IY":
cpu.RegisterIY = (byte)value;
break;
case "L":
cpu.RegisterL = (byte)value;
break;
case "PC":
cpu.RegisterPC = (ushort)value;
break;
case "R":
cpu.RegisterR = (byte)value;
break;
case "Shadow AF":
cpu.RegisterShadowAF = (byte)value;
break;
case "Shadow BC":
cpu.RegisterShadowBC = (byte)value;
break;
case "Shadow DE":
cpu.RegisterShadowDE = (byte)value;
break;
case "Shadow HL":
cpu.RegisterShadowHL = (byte)value;
break;
case "SP":
cpu.RegisterSP = (byte)value;
break;
}
}
}
}

View File

@ -123,7 +123,7 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64
board.cpu.S = (byte)value;
break;
case "PC":
board.cpu.PC = (byte)value;
board.cpu.PC = (ushort)value;
break;
}
}

View File

@ -141,7 +141,7 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64
//Console.WriteLine("CPUPC: " + C64Util.ToHex(board.cpu.PC, 4) + " 1541PC: " + C64Util.ToHex(disk.PC, 4));
int test = board.cpu.LagCycles;
int test = board.cpu.LagCycles;
CoreComm.DriveLED = DriveLED;
}

View File

@ -212,7 +212,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
Cpu.S = (byte)value;
break;
case "PC":
Cpu.PC = (byte)value;
Cpu.PC = (ushort)value;
break;
case "Flag I":
Cpu.FlagI = value > 0;

View File

@ -49,7 +49,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari7800
theMachine.CPU.P = (byte)value;
break;
case "PC":
theMachine.CPU.PC = (byte)value;
theMachine.CPU.PC = (ushort)value;
break;
case "S":
theMachine.CPU.S = (byte)value;

View File

@ -296,7 +296,77 @@ namespace BizHawk.Emulation.Cores.ColecoVision
public void SetCpuRegister(string register, int value)
{
throw new NotImplementedException();
switch (register)
{
default:
throw new InvalidOperationException();
case "A":
Cpu.RegisterA = (byte)value;
break;
case "AF":
Cpu.RegisterAF = (byte)value;
break;
case "B":
Cpu.RegisterB = (byte)value;
break;
case "BC":
Cpu.RegisterBC = (byte)value;
break;
case "C":
Cpu.RegisterC = (byte)value;
break;
case "D":
Cpu.RegisterD = (byte)value;
break;
case "DE":
Cpu.RegisterDE = (byte)value;
break;
case "E":
Cpu.RegisterE = (byte)value;
break;
case "F":
Cpu.RegisterF = (byte)value;
break;
case "H":
Cpu.RegisterH = (byte)value;
break;
case "HL":
Cpu.RegisterHL = (byte)value;
break;
case "I":
Cpu.RegisterI = (byte)value;
break;
case "IX":
Cpu.RegisterIX = (byte)value;
break;
case "IY":
Cpu.RegisterIY = (byte)value;
break;
case "L":
Cpu.RegisterL = (byte)value;
break;
case "PC":
Cpu.RegisterPC = (ushort)value;
break;
case "R":
Cpu.RegisterR = (byte)value;
break;
case "Shadow AF":
Cpu.RegisterShadowAF = (byte)value;
break;
case "Shadow BC":
Cpu.RegisterShadowBC = (byte)value;
break;
case "Shadow DE":
Cpu.RegisterShadowDE = (byte)value;
break;
case "Shadow HL":
Cpu.RegisterShadowHL = (byte)value;
break;
case "SP":
Cpu.RegisterSP = (byte)value;
break;
}
}
}
}

View File

@ -906,7 +906,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
cpu.S = (byte)value;
break;
case "PC":
cpu.PC = (byte)value;
cpu.PC = (ushort)value;
break;
case "Flag I":
cpu.FlagI = value > 0;

View File

@ -512,7 +512,77 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
public void SetCpuRegister(string register, int value)
{
throw new NotImplementedException();
switch (register)
{
default:
throw new InvalidOperationException();
case "A":
Cpu.RegisterA = (byte)value;
break;
case "AF":
Cpu.RegisterAF = (byte)value;
break;
case "B":
Cpu.RegisterB = (byte)value;
break;
case "BC":
Cpu.RegisterBC = (byte)value;
break;
case "C":
Cpu.RegisterC = (byte)value;
break;
case "D":
Cpu.RegisterD = (byte)value;
break;
case "DE":
Cpu.RegisterDE = (byte)value;
break;
case "E":
Cpu.RegisterE = (byte)value;
break;
case "F":
Cpu.RegisterF = (byte)value;
break;
case "H":
Cpu.RegisterH = (byte)value;
break;
case "HL":
Cpu.RegisterHL = (byte)value;
break;
case "I":
Cpu.RegisterI = (byte)value;
break;
case "IX":
Cpu.RegisterIX = (byte)value;
break;
case "IY":
Cpu.RegisterIY = (byte)value;
break;
case "L":
Cpu.RegisterL = (byte)value;
break;
case "PC":
Cpu.RegisterPC = (ushort)value;
break;
case "R":
Cpu.RegisterR = (byte)value;
break;
case "Shadow AF":
Cpu.RegisterShadowAF = (byte)value;
break;
case "Shadow BC":
Cpu.RegisterShadowBC = (byte)value;
break;
case "Shadow DE":
Cpu.RegisterShadowDE = (byte)value;
break;
case "Shadow HL":
Cpu.RegisterShadowHL = (byte)value;
break;
case "SP":
Cpu.RegisterSP = (byte)value;
break;
}
}
public void Dispose() { }