about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-05-05 20:02:38 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-05-05 20:02:38 -0700
commit621bbcb0fda324db550207253e78fb590f40d4a8 (patch)
treecf568b257e10880154408b22f47a42709ee6b6d6
parent4caa718f6b28871acc858cb9e5de7e0c4a7cba0f (diff)
downloadmu-621bbcb0fda324db550207253e78fb590f40d4a8.tar.gz
1273 - fix display.mu example program
-rw-r--r--cpp/070display.cc11
1 files changed, 10 insertions, 1 deletions
diff --git a/cpp/070display.cc b/cpp/070display.cc
index 350b9c4d..aa2c31b8 100644
--- a/cpp/070display.cc
+++ b/cpp/070display.cc
@@ -1,5 +1,9 @@
 //: Take charge of the text-mode display and keyboard.
 
+// uncomment to debug console programs
+:(before "End Globals")
+//? ofstream LOG("log.txt");
+
 //:: Display management
 
 :(before "End Globals")
@@ -166,13 +170,18 @@ WAIT_FOR_KEY_FROM_KEYBOARD,
 Recipe_number["wait-for-key-from-keyboard"] = WAIT_FOR_KEY_FROM_KEYBOARD;
 :(before "End Primitive Recipe Implementations")
 case WAIT_FOR_KEY_FROM_KEYBOARD: {
+//? LOG << "AAA\n";  LOG.flush();
   struct tb_event event;
   do {
     tb_poll_event(&event);
   } while (event.type != TB_EVENT_KEY);
+//? LOG << "AAA 2\n";  LOG.flush();
   vector<long long int> result;
   result.push_back(event.ch);
-  write_memory(current_instruction().products[0], result);
+//? LOG << "AAA 3\n";  LOG.flush();
+  if (!current_instruction().products.empty())
+    write_memory(current_instruction().products[0], result);
+//? LOG << "AAA 9\n";  LOG.flush();
   break;
 }