about summary refs log tree commit diff stats
path: root/subx
diff options
context:
space:
mode:
Diffstat (limited to 'subx')
-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) {