about summary refs log tree commit diff stats
path: root/subx
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2017-10-12 23:32:08 -0700
committerKartik K. Agaram <vc@akkartik.com>2017-10-12 23:32:08 -0700
commit7bd02c4145902dd0f0b9287c2262b9342899e158 (patch)
tree005ae0a33a580bf7314b0b381cc28ee5bfd5ef61 /subx
parent159af423673c96a35947e85a788689d216f6e2fb (diff)
downloadmu-7bd02c4145902dd0f0b9287c2262b9342899e158.tar.gz
4050
Diffstat (limited to 'subx')
-rw-r--r--subx/012direct_addressing.cc18
1 files changed, 18 insertions, 0 deletions
diff --git a/subx/012direct_addressing.cc b/subx/012direct_addressing.cc
index d788904b..6352d90c 100644
--- a/subx/012direct_addressing.cc
+++ b/subx/012direct_addressing.cc
@@ -1,5 +1,14 @@
 //: operating directly on a register
 
+:(scenario add_r32_to_r32)
+% Reg[0].i = 0x10;
+% Reg[3].i = 1;
+# op  ModR/M  SIB   displacement  immediate
+  01  d8                                      # add EBX (reg 3) to EAX (reg 0)
++run: add reg 3 to effective address
++run: effective address is reg 0
++run: storing 0x00000011
+
 :(before "End Mod Special-cases")
 case 3:
   // mod 3 is just register direct addressing
@@ -8,3 +17,12 @@ case 3:
   break;
 
 //:: subtract
+
+:(scenario subtract_r32_from_r32)
+% Reg[0].i = 10;
+% Reg[3].i = 1;
+# op  ModR/M  SIB   displacement  immediate
+  29  d8                                      # subtract EBX (reg 3) from EAX (reg 0)
++run: subtract reg 3 from effective address
++run: effective address is reg 0
++run: storing 0x00000009