about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2017-10-12 22:57:55 -0700
committerKartik K. Agaram <vc@akkartik.com>2017-10-12 22:57:55 -0700
commitd98c81387023ff618f8d569c54bb9777371edaaf (patch)
tree3052f121d6799160ab3e104e1884e7f5d29c6baf
parent6c112cbc14503d9a48b71802d5879dd03a259450 (diff)
downloadmu-d98c81387023ff618f8d569c54bb9777371edaaf.tar.gz
4047
-rw-r--r--subx/011add.cc22
1 files changed, 22 insertions, 0 deletions
diff --git a/subx/011add.cc b/subx/011add.cc
index 82495865..ea6619fc 100644
--- a/subx/011add.cc
+++ b/subx/011add.cc
@@ -168,3 +168,25 @@ case 5: {
 +run: effective address is mem at address 0x60 (reg 3)
 +run: subop subtract
 +run: storing 0x00000009
+
+//:
+
+:(scenario sub_r32_from_mem_at_r32)
+% Reg[0].i = 0x60;
+% Mem.at(0x60) = 10;
+% Reg[3].i = 1;
+# op  ModRM   SIB   displacement  immediate
+  29  18                                      # subtract EBX (reg 3) from *EAX (reg 0)
++run: subtract reg 3 from effective address
++run: effective address is mem at address 0x60 (reg 0)
++run: storing 0x00000009
+
+:(before "End Single-Byte Opcodes")
+case 0x29: {  // subtract r32 from r/m32
+  uint8_t modrm = next();
+  uint8_t arg2 = (modrm>>3)&0x7;
+  trace(2, "run") << "subtract reg " << NUM(arg2) << " from effective address" << end();
+  int32_t* arg1 = effective_address(modrm);
+  BINARY_ARITHMETIC_OP(-, *arg1, Reg[arg2].i);
+  break;
+}