about summary refs log tree commit diff stats
path: root/subx
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2017-10-13 01:23:55 -0700
committerKartik K. Agaram <vc@akkartik.com>2017-10-13 01:24:13 -0700
commit5a25c6e66f78b0c5588af9de8d42e30e0d2232f3 (patch)
tree92f58c153f5fd5417919f8b890098f5d6d252fbe /subx
parent8745e7456a4a14e0c0220fe8c6a5f988fdd39a29 (diff)
downloadmu-5a25c6e66f78b0c5588af9de8d42e30e0d2232f3.tar.gz
4058
Diffstat (limited to 'subx')
-rw-r--r--subx/011direct_addressing.cc23
-rw-r--r--subx/012indirect_addressing.cc15
2 files changed, 38 insertions, 0 deletions
diff --git a/subx/011direct_addressing.cc b/subx/011direct_addressing.cc
index 3286cbea..a1d83b8c 100644
--- a/subx/011direct_addressing.cc
+++ b/subx/011direct_addressing.cc
@@ -125,3 +125,26 @@ case 0x31: {  // xor r32 with r/m32
   BINARY_BITWISE_OP(^, *arg1, Reg[arg2].u);
   break;
 }
+
+//:: not
+
+:(scenario not_r32)
+% Reg[3].i = 0x0f0f00ff;
+# op  ModR/M  SIB   displacement  immediate
+  f7  c3                                      # not EBX (reg 3)
++run: 'not' of effective address
++run: effective address is reg 3
++run: storing 0xf0f0ff00
+
+:(before "End Single-Byte Opcodes")
+case 0xf7: {  // xor r32 with r/m32
+  uint8_t modrm = next();
+  trace(2, "run") << "'not' of effective address" << end();
+  int32_t* arg1 = effective_address(modrm);
+  *arg1 = ~(*arg1);
+  trace(2, "run") << "storing 0x" << HEXWORD << *arg1 << end();
+  SF = (*arg1 >> 31);
+  ZF = (*arg1 == 0);
+  OF = false;
+  break;
+}
diff --git a/subx/012indirect_addressing.cc b/subx/012indirect_addressing.cc
index 3c3fae3c..4095fb1b 100644
--- a/subx/012indirect_addressing.cc
+++ b/subx/012indirect_addressing.cc
@@ -196,3 +196,18 @@ case 0x33: {  // xor r/m32 with r32
   BINARY_BITWISE_OP(|, Reg[arg1].u, *arg2);
   break;
 }
+
+//:: not
+
+:(scenario not_r32_with_mem_at_r32)
+% Reg[3].i = 0x60;
+# word at 0x60 is 0x0f0f00ff
+% Mem.at(0x60) = 0xff;
+% Mem.at(0x61) = 0x00;
+% Mem.at(0x62) = 0x0f;
+% Mem.at(0x63) = 0x0f;
+# op  ModRM   SIB   displacement  immediate
+  f7  03                                      # negate *EBX (reg 3)
++run: 'not' of effective address
++run: effective address is mem at address 0x60 (reg 3)
++run: storing 0xf0f0ff00