public string Describe(OpcodeMachine opcodeMachine) { if (Action == Jump) { return($"jmp {opcodeMachine.InstructionPointer + Argument} ({this.LineOrigin})"); } else if (Action == NoOperation) { return($"nop {opcodeMachine.InstructionPointer + Argument} ({this.LineOrigin})"); } else { return(this.ToString()); } }
public void Accumulate(OpcodeMachine opm) { opm.Accumulator += Argument; opm.InstructionPointer++; }
public void UndoNoOperation(OpcodeMachine opm) { opm.InstructionPointer--; }
public void NoOperation(OpcodeMachine opm) { opm.InstructionPointer++; }
public void UndoJump(OpcodeMachine opm) { opm.InstructionPointer -= Argument; }
public void UndoAccumulate(OpcodeMachine opm) { opm.Accumulator -= Argument; opm.InstructionPointer--; }