diff options
author | Kartik Agaram <vc@akkartik.com> | 2018-07-27 10:15:03 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2018-07-27 10:15:03 -0700 |
commit | 3f4bbe9e5fd1389720c7adb5577edf2dc01d51e9 (patch) | |
tree | 61d80e20e59be711010dd4a1665afedc8d9bb93a /subx/010vm.cc | |
parent | 667d21177b9d8fe3652710b818d13940b23511d7 (diff) | |
download | mu-3f4bbe9e5fd1389720c7adb5577edf2dc01d51e9.tar.gz |
4434
Key core data structures by hex bytes in text rather than opcode numbers. Saves us round trips of having to parse and reparse strings, and also allows us to more easily ignore unexpected non-hex words in each transform. We'll use this ability next when we start inserting labels.
Diffstat (limited to 'subx/010vm.cc')
-rw-r--r-- | subx/010vm.cc | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/subx/010vm.cc b/subx/010vm.cc index 4d13f27d..5ea40bbc 100644 --- a/subx/010vm.cc +++ b/subx/010vm.cc @@ -193,29 +193,29 @@ inline uint8_t next() { //: 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; +map</*op*/string, string> name; +map</*op*/string, string> name_0f; +map</*op*/string, string> name_f3; +map</*op*/string, string> name_f3_0f; :(before "End One-time Setup") init_op_names(); :(code) void init_op_names() { - put(name, 0xf4, "halt"); + put(name, "f4", "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'; + for (map<string, string>::iterator p = name.begin(); p != name.end(); ++p) + cerr << " " << p->first << ": " << p->second << '\n'; + for (map<string, string>::iterator p = name_0f.begin(); p != name_0f.end(); ++p) + cerr << " 0f " << p->first << ": " << p->second << '\n'; + for (map<string, string>::iterator p = name_f3.begin(); p != name_f3.end(); ++p) + cerr << " f3 " << p->first << ": " << p->second << '\n'; + for (map<string, string>::iterator p = name_f3_0f.begin(); p != name_f3_0f.end(); ++p) + cerr << " f3 0f " << p->first << ": " << p->second << '\n'; cerr << "Run `subx help instructions` for details on words like 'r32' and 'disp8'.\n"; return 0; } |