about summary refs log tree commit diff stats
path: root/subx/011parse.cc
diff options
context:
space:
mode:
Diffstat (limited to 'subx/011parse.cc')
-rw-r--r--subx/011parse.cc23
1 files changed, 23 insertions, 0 deletions
diff --git a/subx/011parse.cc b/subx/011parse.cc
index b5914d2c..c6d66ff4 100644
--- a/subx/011parse.cc
+++ b/subx/011parse.cc
@@ -225,3 +225,26 @@ int32_t imm32() {
   result |= (next()<<24);
   return result;
 }
+
+//: start tracking supported opcodes
+:(before "End Globals")
+map</*op*/uint8_t, string> name;
+:(before "End One-time Setup")
+init_op_names();
+:(code)
+void init_op_names() {
+  put(name, 0xf4, "halt");
+  put(name, 0x05, "add imm32 to register R0 (EAX)");
+  // End Initialize Op Names(name)
+}
+
+:(before "End Help Special-cases(key)")
+if (key == "opcodes") {
+  cerr << "Opcodes currently supported by SubX:\n";
+  for (map<uint8_t, string>::iterator p = name.begin();  p != name.end();  ++p)
+    cerr << "  " << HEXBYTE << NUM(p->first) << ": " << p->second << '\n';
+  cerr << "Coming soon: `subx help operands` for details on words like 'r32' and 'disp8'.\n";
+  return 0;
+}
+:(before "End Help Contents")
+cerr << "  opcodes\n";