about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2018-07-30 14:07:55 -0700
committerKartik Agaram <vc@akkartik.com>2018-07-30 14:07:55 -0700
commitb359facba940e9171c31c2dc67661097b53ebd08 (patch)
tree7180780017f566d13abd285b8e63bc2ea57e6123
parent10f4dd63cfb8580b3acbd1173d3ec950a5835d78 (diff)
downloadmu-b359facba940e9171c31c2dc67661097b53ebd08.tar.gz
4460
Some debugging affordances.
-rw-r--r--subx/010vm.cc10
1 files changed, 6 insertions, 4 deletions
diff --git a/subx/010vm.cc b/subx/010vm.cc
index 0a549982..c467255b 100644
--- a/subx/010vm.cc
+++ b/subx/010vm.cc
@@ -148,8 +148,10 @@ void run_one_instruction() {
   uint8_t op=0, op2=0, op3=0;
   trace(90, "run") << "inst: 0x" << HEXWORD << EIP << end();
 //?   dump_registers();
-//?   cerr << "inst: 0x" << EIP << '\n';
-  switch (op = next()) {
+//?   cerr << "inst: 0x" << EIP << " => ";
+  op = next();
+//?   cerr << HEXBYTE << NUM(op) << '\n';
+  switch (op) {
   case 0xf4:  // hlt
     EIP = End_of_program;
     break;
@@ -195,9 +197,9 @@ inline uint8_t next() {
 void dump_registers() {
   for (int i = 0;  i < NUM_INT_REGISTERS;  ++i) {
     if (i > 0) cerr << "; ";
-    cerr << "  " << i << ": " << HEXWORD << Reg[i].u;
+    cerr << "  " << i << ": " << std::hex << std::setw(8) << std::setfill('_') << Reg[i].u;
   }
-  cerr << '\n';
+  cerr << " -- SF: " << SF << "; ZF: " << ZF << "; OF: " << OF << '\n';
 }
 
 //: start tracking supported opcodes