about summary refs log tree commit diff stats
path: root/cpp/023jump
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/023jump')
-rw-r--r--cpp/023jump16
1 files changed, 8 insertions, 8 deletions
diff --git a/cpp/023jump b/cpp/023jump
index 2835e040..d4dd6094 100644
--- a/cpp/023jump
+++ b/cpp/023jump
@@ -6,8 +6,8 @@ JUMP,
 Recipe_number["jump"] = JUMP;
 :(before "End Primitive Recipe Implementations")
 case JUMP: {
-  trace("run") << "ingredient 0 is " << instructions[pc].ingredients[0].value;
-  pc += instructions[pc].ingredients[0].value;
+  trace("run") << "ingredient 0 is " << current_instruction().ingredients[0].value;
+  pc += current_instruction().ingredients[0].value;
   trace("run") << "jumping to instruction " << pc+1;
   break;
 }
@@ -39,15 +39,15 @@ JUMP_IF,
 Recipe_number["jump-if"] = JUMP_IF;
 :(before "End Primitive Recipe Implementations")
 case JUMP_IF: {
-  vector<int> arg0 = read_memory(instructions[pc].ingredients[0]);
+  vector<int> arg0 = read_memory(current_instruction().ingredients[0]);
   assert(arg0.size() == 1);
   trace("run") << "ingredient 0 is " << arg0[0];
   if (!arg0[0]) {
     trace("run") << "jump-if fell through";
     break;
   }
-  trace("run") << "ingredient 1 is " << instructions[pc].ingredients[1].name;
-  pc += instructions[pc].ingredients[1].value;
+  trace("run") << "ingredient 1 is " << current_instruction().ingredients[1].name;
+  pc += current_instruction().ingredients[1].value;
   trace("run") << "jumping to instruction " << pc+1;
   break;
 }
@@ -79,15 +79,15 @@ JUMP_UNLESS,
 Recipe_number["jump-unless"] = JUMP_UNLESS;
 :(before "End Primitive Recipe Implementations")
 case JUMP_UNLESS: {
-  vector<int> arg0 = read_memory(instructions[pc].ingredients[0]);
+  vector<int> arg0 = read_memory(current_instruction().ingredients[0]);
   assert(arg0.size() == 1);
   trace("run") << "ingredient 0 is " << arg0[0];
   if (arg0[0]) {
     trace("run") << "jump-unless fell through";
     break;
   }
-  trace("run") << "ingredient 1 is " << instructions[pc].ingredients[1].name;
-  pc += instructions[pc].ingredients[1].value;
+  trace("run") << "ingredient 1 is " << current_instruction().ingredients[1].name;
+  pc += current_instruction().ingredients[1].value;
   trace("run") << "jumping to instruction " << pc+1;
   break;
 }