about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--cpp/090debug13
1 files changed, 13 insertions, 0 deletions
diff --git a/cpp/090debug b/cpp/090debug
new file mode 100644
index 00000000..ca88b86c
--- /dev/null
+++ b/cpp/090debug
@@ -0,0 +1,13 @@
+:(before "End Globals")
+// Operator to look at fields of records.
+const int _PRINT = 99;
+:(before "End Primitive Recipe Numbers")
+Recipe_number["$print"] = _PRINT;
+assert(Next_recipe_number < _PRINT);
+:(before "End Primitive Recipe Implementations")
+//: beware: overridden in later layers
+case _PRINT: {
+  vector<int> result(read_memory(instructions[pc].ingredients[0]));
+  cout << result[0] << '\n';
+  break;
+}