Пример #1
0
 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());
     }
 }
Пример #2
0
 public void Accumulate(OpcodeMachine opm)
 {
     opm.Accumulator += Argument;
     opm.InstructionPointer++;
 }
Пример #3
0
 public void UndoNoOperation(OpcodeMachine opm)
 {
     opm.InstructionPointer--;
 }
Пример #4
0
 public void NoOperation(OpcodeMachine opm)
 {
     opm.InstructionPointer++;
 }
Пример #5
0
 public void UndoJump(OpcodeMachine opm)
 {
     opm.InstructionPointer -= Argument;
 }
Пример #6
0
 public void UndoAccumulate(OpcodeMachine opm)
 {
     opm.Accumulator -= Argument;
     opm.InstructionPointer--;
 }