public static void Callm(Cpu cpu, uint rX) { var vAddr = cpu.Registers[rX]; var value = cpu.Read(vAddr); cpu.Call(value); }
public static void Printm(Cpu cpu, uint rX) { var vAddr = cpu.Registers[rX]; var value = cpu.Read(vAddr); cpu.Print(value); }
public static void Movmm(Cpu cpu, uint rX, uint rY) { var vAddr = cpu.Registers[rY]; var value = cpu.Read(vAddr); vAddr = cpu.Registers[rX]; cpu.Write(vAddr, value); }
public static void Cmprm(Cpu cpu, uint rX, uint rY) { var vAddr = cpu.Registers[rY]; var lValue = cpu.Registers[rX]; var rValue = cpu.Read(vAddr); cpu.Sf = (lValue < rValue); cpu.Zf = (lValue == rValue); }
private static uint ReadValue(Cpu cpu, OpCodeFlag flag, uint param) { switch (flag) { case OpCodeFlag.Register: return(cpu.Registers[param]); case OpCodeFlag.MemoryAddress: return(cpu.Read(cpu.Registers[param])); case OpCodeFlag.Constant: return(param); default: throw new ArgumentOutOfRangeException(nameof(flag)); } }
public static void Movmr(Cpu cpu, uint rX, uint rY) { var vAddr = cpu.Registers[rY]; cpu.Registers[rX] = cpu.Read(vAddr); }
private static uint ReadValue(Cpu cpu, OpCodeFlag flag, uint param) { switch (flag) { case OpCodeFlag.Register: return cpu.Registers[param]; case OpCodeFlag.MemoryAddress: return cpu.Read(cpu.Registers[param]); case OpCodeFlag.Constant: return param; default: throw new ArgumentOutOfRangeException(nameof(flag)); } }