public override void Execute(CPU cpu) { object value = cpu.PopStack(); cpu.PushStack(value); cpu.PushStack(value); }
public override void Execute(CPU cpu) { object value = cpu.PopValue(); bool result = Convert.ToBoolean(value); cpu.PushStack(result); }
public override void Execute(CPU cpu) { bool argument2 = Convert.ToBoolean(cpu.PopValue()); bool argument1 = Convert.ToBoolean(cpu.PopValue()); object result = argument1 | argument2; cpu.PushStack(result); }
public override void Execute(CPU cpu) { argument2 = cpu.PopValue(); argument1 = cpu.PopValue(); Calculator calc = GetCalculator(); object result = ExecuteCalculation(calc); cpu.PushStack(result); }
public override void Execute(CPU cpu) { object functionPointer = cpu.GetValue(destination); if (functionPointer is int) { int currentPointer = cpu.InstructionPointer; DeltaInstructionPointer = (int)functionPointer - currentPointer; cpu.PushStack(currentPointer + 1); cpu.MoveStackPointer(-1); } else { if (functionPointer is string) { string functionName = (string)functionPointer; functionName = functionName.Substring(0, functionName.Length - 2); cpu.CallBuiltinFunction(functionName); } } }
public override void Execute(CPU cpu) { object value = cpu.PopValue(); object result; if (value is bool) { result = !((bool)value); } else if (value is int) { result = -((int)value); } else if (value is double) { result = -((double)value); } else { throw new ArgumentException(string.Format("Can't negate object {0} of type {1}", value, value.GetType())); } cpu.PushStack(result); }
public override void Execute(CPU cpu) { cpu.PushStack(argument); }