about summary refs log tree commit diff stats
path: root/subx/010vm.cc
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2018-07-20 22:16:04 -0700
committerKartik Agaram <vc@akkartik.com>2018-07-20 22:16:04 -0700
commit62197fd5a73f1b6798332161b652ce27f56ae820 (patch)
tree891d428c5fbaa197fc3b7cce63f11b8a5456538b /subx/010vm.cc
parent7ecc45c1352c8bf253c6e35e6a9e785219945855 (diff)
downloadmu-62197fd5a73f1b6798332161b652ce27f56ae820.tar.gz
4383
Make room for including multibyte opcodes in the opcode list.
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')