about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2018-07-22 19:04:40 -0700
committerKartik Agaram <vc@akkartik.com>2018-07-22 19:04:40 -0700
commit026ed1af761c592933997e2192da598af3306040 (patch)
treedb55667f8d42bced4fce86f4639daae3427eab73
parent26b1b48f48fee5166b38e19bf61ead4d1aab50fb (diff)
downloadmu-026ed1af761c592933997e2192da598af3306040.tar.gz
4387
-rw-r--r--subx/022check_instruction.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/subx/022check_instruction.cc b/subx/022check_instruction.cc
index e5ccbdca..a1852d84 100644
--- a/subx/022check_instruction.cc
+++ b/subx/022check_instruction.cc
@@ -233,7 +233,7 @@ void check_operands_modrm(const line& inst) {
 void compare_bitvector(uint8_t op, const line& inst, uint8_t expected) {
   uint8_t bitvector = compute_operand_bitvector(inst);
   if (trace_contains_errors()) return;  // duplicate operand type
-  if (bitvector == 0 && expected != 0 && has_operands(inst)) return;  // deliberately programming in raw hex; we'll raise a warning elsewhere
+  if (bitvector == 0 && expected != 0 && has_operands(inst) && all_hex_bytes(inst)) return;  // deliberately programming in raw hex; we'll raise a warning elsewhere
   if (bitvector == expected) return;  // all good with this instruction
   for (int i = 0;  i < NUM_OPERAND_TYPES;  ++i, bitvector >>= 1, expected >>= 1) {
 //?     cerr << "comparing " << HEXBYTE << NUM(bitvector) << " with " << NUM(expected) << '\n';
@@ -256,6 +256,13 @@ bool has_operands(const line& inst) {
   return true;
 }
 
+bool all_hex_bytes(const line& inst) {
+  for (int i = 0;  i < SIZE(inst.words);  ++i)
+    if (inst.words.at(i).data.find_first_not_of("0123456789abcdefABCDEF") != string::npos)
+      return false;
+  return true;
+}
+
 uint32_t compute_operand_bitvector(const line& inst) {
   uint32_t bitvector = 0;
   for (int i = /*skip op*/1;  i < SIZE(inst.words);  ++i) {