about summary refs log tree commit diff stats
path: root/subx/010vm.cc
diff options
context:
space:
mode:
Diffstat (limited to 'subx/010vm.cc')
-rw-r--r--subx/010vm.cc31
1 files changed, 31 insertions, 0 deletions
diff --git a/subx/010vm.cc b/subx/010vm.cc
index 9d6d047d..799bcbcc 100644
--- a/subx/010vm.cc
+++ b/subx/010vm.cc
@@ -181,6 +181,37 @@ inline uint8_t next() {
   return read_mem_u8(EIP++);
 }
 
+//: start tracking supported opcodes
+:(before "End Globals")
+map</*op*/uint8_t, string> name;
+map</*op*/uint8_t, string> name_0f;
+map</*op*/uint8_t, string> name_f3;
+map</*op*/uint8_t, string> name_f3_0f;
+:(before "End One-time Setup")
+init_op_names();
+:(code)
+void init_op_names() {
+  put(name, 0xf4, "halt");
+  // 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';
+  for (map<uint8_t, string>::iterator p = name_0f.begin();  p != name_0f.end();  ++p)
+    cerr << "  0f " << HEXBYTE << NUM(p->first) << ": " << p->second << '\n';
+  for (map<uint8_t, string>::iterator p = name_f3.begin();  p != name_f3.end();  ++p)
+    cerr << "  f3 " << HEXBYTE << NUM(p->first) << ": " << p->second << '\n';
+  for (map<uint8_t, string>::iterator p = name_f3_0f.begin();  p != name_f3_0f.end();  ++p)
+    cerr << "  f3 0f " << 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";
+
 :(before "End Includes")
 #include <iomanip>
 #define HEXBYTE  std::hex << std::setw(2) << std::setfill('0')