about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--html/subx/011direct_addressing.cc.html23
-rw-r--r--html/subx/012indirect_addressing.cc.html35
-rw-r--r--html/subx/013immediate_addressing.cc.html37
-rw-r--r--subx/011direct_addressing.cc23
-rw-r--r--subx/012indirect_addressing.cc35
-rw-r--r--subx/013immediate_addressing.cc37
6 files changed, 184 insertions, 6 deletions
diff --git a/html/subx/011direct_addressing.cc.html b/html/subx/011direct_addressing.cc.html
index 67117464..b8d9a853 100644
--- a/html/subx/011direct_addressing.cc.html
+++ b/html/subx/011direct_addressing.cc.html
@@ -214,7 +214,7 @@ if ('onhashchange' in window) {
 <span id="L149" class="LineNr">149 </span>  <span class="Identifier">break</span><span class="Delimiter">;</span>
 <span id="L150" class="LineNr">150 </span><span class="Delimiter">}</span>
 <span id="L151" class="LineNr">151 </span>
-<span id="L152" class="LineNr">152 </span><span class="SalientComment">//:: compare</span>
+<span id="L152" class="LineNr">152 </span><span class="SalientComment">//:: compare (cmp)</span>
 <span id="L153" class="LineNr">153 </span>
 <span id="L154" class="LineNr">154 </span><span class="Delimiter">:(scenario compare_r32_with_r32_greater)</span>
 <span id="L155" class="LineNr">155 </span><span class="Special">% Reg[0].i = 0x0a0b0c0d;</span>
@@ -258,6 +258,27 @@ if ('onhashchange' in window) {
 <span id="L193" class="LineNr">193 </span><span class="traceContains">+run: compare <a href='010core.cc.html#L15'>reg</a> 3 with effective address</span>
 <span id="L194" class="LineNr">194 </span><span class="traceContains">+run: effective address is <a href='010core.cc.html#L15'>reg</a> 0</span>
 <span id="L195" class="LineNr">195 </span><span class="traceContains">+run: SF=0; ZF=1; OF=0</span>
+<span id="L196" class="LineNr">196 </span>
+<span id="L197" class="LineNr">197 </span><span class="SalientComment">//:: copy (mov)</span>
+<span id="L198" class="LineNr">198 </span>
+<span id="L199" class="LineNr">199 </span><span class="Delimiter">:(scenario copy_r32_to_r32)</span>
+<span id="L200" class="LineNr">200 </span><span class="Special">% Reg[3].i = 0xaf;</span>
+<span id="L201" class="LineNr">201 </span><span class="Comment"># op  ModRM   SIB   displacement  immediate</span>
+<span id="L202" class="LineNr">202 </span>  <span class="Constant">89</span>  d8                                      <span class="Comment"># copy EBX (reg 3) to EAX (reg 0)</span>
+<span id="L203" class="LineNr">203 </span><span class="traceContains">+run: copy <a href='010core.cc.html#L15'>reg</a> 3 to effective address</span>
+<span id="L204" class="LineNr">204 </span><span class="traceContains">+run: effective address is <a href='010core.cc.html#L15'>reg</a> 0</span>
+<span id="L205" class="LineNr">205 </span><span class="traceContains">+run: storing 0x000000af</span>
+<span id="L206" class="LineNr">206 </span>
+<span id="L207" class="LineNr">207 </span><span class="Delimiter">:(before &quot;End Single-Byte Opcodes&quot;)</span>
+<span id="L208" class="LineNr">208 </span><span class="Normal">case</span> <span class="Constant">0x89</span>: <span class="Delimiter">{</span>  <span class="Comment">// copy r32 to r/m32</span>
+<span id="L209" class="LineNr">209 </span>  <span class="Normal">uint8_t</span> modrm = <a href='010core.cc.html#L210'>next</a><span class="Delimiter">();</span>
+<span id="L210" class="LineNr">210 </span>  <span class="Normal">uint8_t</span> reg2 = <span class="Delimiter">(</span>modrm&gt;&gt;<span class="Constant">3</span><span class="Delimiter">)</span>&amp;<span class="Constant">0x7</span><span class="Delimiter">;</span>
+<span id="L211" class="LineNr">211 </span>  <a href='003trace.cc.html#L160'>trace</a><span class="Delimiter">(</span><span class="Constant">2</span><span class="Delimiter">,</span> <span class="Constant">&quot;run&quot;</span><span class="Delimiter">)</span> &lt;&lt; <span class="Constant">&quot;copy <a href='010core.cc.html#L15'>reg</a> &quot;</span> &lt;&lt; <a href='010core.cc.html#L228'>NUM</a><span class="Delimiter">(</span>reg2<span class="Delimiter">)</span> &lt;&lt; <span class="Constant">&quot; to effective address&quot;</span> &lt;&lt; <a href='003trace.cc.html#L184'>end</a><span class="Delimiter">();</span>
+<span id="L212" class="LineNr">212 </span>  <span class="Normal">int32_t</span>* arg1 = <a href='011direct_addressing.cc.html#L26'>effective_address</a><span class="Delimiter">(</span>modrm<span class="Delimiter">);</span>
+<span id="L213" class="LineNr">213 </span>  *arg1 = Reg[reg2]<span class="Delimiter">.</span><a href='010core.cc.html#L16'>i</a><span class="Delimiter">;</span>
+<span id="L214" class="LineNr">214 </span>  <a href='003trace.cc.html#L160'>trace</a><span class="Delimiter">(</span><span class="Constant">2</span><span class="Delimiter">,</span> <span class="Constant">&quot;run&quot;</span><span class="Delimiter">)</span> &lt;&lt; <span class="Constant">&quot;storing 0x&quot;</span> &lt;&lt; <a href='010core.cc.html#L226'>HEXWORD</a> &lt;&lt; *arg1 &lt;&lt; <a href='003trace.cc.html#L184'>end</a><span class="Delimiter">();</span>
+<span id="L215" class="LineNr">215 </span>  <span class="Identifier">break</span><span class="Delimiter">;</span>
+<span id="L216" class="LineNr">216 </span><span class="Delimiter">}</span>
 </pre>
 </body>
 </html>
diff --git a/html/subx/012indirect_addressing.cc.html b/html/subx/012indirect_addressing.cc.html
index ab3650f6..b43a2098 100644
--- a/html/subx/012indirect_addressing.cc.html
+++ b/html/subx/012indirect_addressing.cc.html
@@ -257,7 +257,7 @@ if ('onhashchange' in window) {
 <span id="L193" class="LineNr">193 </span><span class="traceContains">+run: effective address is mem at address 0x60 (reg 3)</span>
 <span id="L194" class="LineNr">194 </span><span class="traceContains">+run: storing 0xf0f0ff00</span>
 <span id="L195" class="LineNr">195 </span>
-<span id="L196" class="LineNr">196 </span><span class="SalientComment">//:: compare</span>
+<span id="L196" class="LineNr">196 </span><span class="SalientComment">//:: compare (cmp)</span>
 <span id="L197" class="LineNr">197 </span>
 <span id="L198" class="LineNr">198 </span><span class="Delimiter">:(scenario compare_mem_at_r32_with_r32_greater)</span>
 <span id="L199" class="LineNr">199 </span><span class="Special">% Reg[0].i = 0x60;</span>
@@ -336,6 +336,39 @@ if ('onhashchange' in window) {
 <span id="L272" class="LineNr">272 </span><span class="traceContains">+run: compare effective address with <a href='010core.cc.html#L15'>reg</a> 3</span>
 <span id="L273" class="LineNr">273 </span><span class="traceContains">+run: effective address is mem at address 0x60 (reg 0)</span>
 <span id="L274" class="LineNr">274 </span><span class="traceContains">+run: SF=0; ZF=1; OF=0</span>
+<span id="L275" class="LineNr">275 </span>
+<span id="L276" class="LineNr">276 </span><span class="SalientComment">//:: copy (mov)</span>
+<span id="L277" class="LineNr">277 </span>
+<span id="L278" class="LineNr">278 </span><span class="Delimiter">:(scenario copy_r32_to_mem_at_r32)</span>
+<span id="L279" class="LineNr">279 </span><span class="Special">% Reg[3].i = 0xaf;</span>
+<span id="L280" class="LineNr">280 </span><span class="Special">% Reg[0].i = 0x60;</span>
+<span id="L281" class="LineNr">281 </span><span class="Comment"># op  ModRM   SIB   displacement  immediate</span>
+<span id="L282" class="LineNr">282 </span>  <span class="Constant">89</span>  <span class="Constant">18</span>                                      <span class="Comment"># copy EBX (reg 3) to *EAX (reg 0)</span>
+<span id="L283" class="LineNr">283 </span><span class="traceContains">+run: copy <a href='010core.cc.html#L15'>reg</a> 3 to effective address</span>
+<span id="L284" class="LineNr">284 </span><span class="traceContains">+run: effective address is mem at address 0x60 (reg 0)</span>
+<span id="L285" class="LineNr">285 </span><span class="traceContains">+run: storing 0x000000af</span>
+<span id="L286" class="LineNr">286 </span>
+<span id="L287" class="LineNr">287 </span><span class="Comment">//:</span>
+<span id="L288" class="LineNr">288 </span>
+<span id="L289" class="LineNr">289 </span><span class="Delimiter">:(scenario copy_mem_at_r32_to_r32)</span>
+<span id="L290" class="LineNr">290 </span><span class="Special">% Reg[0].i = 0x60;</span>
+<span id="L291" class="LineNr">291 </span><span class="Special">% SET_WORD_IN_MEM(0x60, 0x000000af);</span>
+<span id="L292" class="LineNr">292 </span><span class="Comment"># op  ModRM   SIB   displacement  immediate</span>
+<span id="L293" class="LineNr">293 </span>  8b  <span class="Constant">18</span>                                      <span class="Comment"># copy *EAX (reg 0) to EBX (reg 3)</span>
+<span id="L294" class="LineNr">294 </span><span class="traceContains">+run: copy effective address to <a href='010core.cc.html#L15'>reg</a> 3</span>
+<span id="L295" class="LineNr">295 </span><span class="traceContains">+run: effective address is mem at address 0x60 (reg 0)</span>
+<span id="L296" class="LineNr">296 </span><span class="traceContains">+run: storing 0x000000af</span>
+<span id="L297" class="LineNr">297 </span>
+<span id="L298" class="LineNr">298 </span><span class="Delimiter">:(before &quot;End Single-Byte Opcodes&quot;)</span>
+<span id="L299" class="LineNr">299 </span><span class="Normal">case</span> <span class="Constant">0x8b</span>: <span class="Delimiter">{</span>  <span class="Comment">// copy r32 to r/m32</span>
+<span id="L300" class="LineNr">300 </span>  <span class="Normal">uint8_t</span> modrm = <a href='010core.cc.html#L210'>next</a><span class="Delimiter">();</span>
+<span id="L301" class="LineNr">301 </span>  <span class="Normal">uint8_t</span> reg1 = <span class="Delimiter">(</span>modrm&gt;&gt;<span class="Constant">3</span><span class="Delimiter">)</span>&amp;<span class="Constant">0x7</span><span class="Delimiter">;</span>
+<span id="L302" class="LineNr">302 </span>  <a href='003trace.cc.html#L160'>trace</a><span class="Delimiter">(</span><span class="Constant">2</span><span class="Delimiter">,</span> <span class="Constant">&quot;run&quot;</span><span class="Delimiter">)</span> &lt;&lt; <span class="Constant">&quot;copy effective address to <a href='010core.cc.html#L15'>reg</a> &quot;</span> &lt;&lt; <a href='010core.cc.html#L228'>NUM</a><span class="Delimiter">(</span>reg1<span class="Delimiter">)</span> &lt;&lt; <a href='003trace.cc.html#L184'>end</a><span class="Delimiter">();</span>
+<span id="L303" class="LineNr">303 </span>  <span class="Normal">int32_t</span>* arg2 = <a href='011direct_addressing.cc.html#L26'>effective_address</a><span class="Delimiter">(</span>modrm<span class="Delimiter">);</span>
+<span id="L304" class="LineNr">304 </span>  Reg[reg1]<span class="Delimiter">.</span><a href='010core.cc.html#L16'>i</a> = *arg2<span class="Delimiter">;</span>
+<span id="L305" class="LineNr">305 </span>  <a href='003trace.cc.html#L160'>trace</a><span class="Delimiter">(</span><span class="Constant">2</span><span class="Delimiter">,</span> <span class="Constant">&quot;run&quot;</span><span class="Delimiter">)</span> &lt;&lt; <span class="Constant">&quot;storing 0x&quot;</span> &lt;&lt; <a href='010core.cc.html#L226'>HEXWORD</a> &lt;&lt; *arg2 &lt;&lt; <a href='003trace.cc.html#L184'>end</a><span class="Delimiter">();</span>
+<span id="L306" class="LineNr">306 </span>  <span class="Identifier">break</span><span class="Delimiter">;</span>
+<span id="L307" class="LineNr">307 </span><span class="Delimiter">}</span>
 </pre>
 </body>
 </html>
diff --git a/html/subx/013immediate_addressing.cc.html b/html/subx/013immediate_addressing.cc.html
index 50164e5e..f7bb47f4 100644
--- a/html/subx/013immediate_addressing.cc.html
+++ b/html/subx/013immediate_addressing.cc.html
@@ -293,7 +293,7 @@ if ('onhashchange' in window) {
 <span id="L229" class="LineNr">229 </span>  <span class="Identifier">break</span><span class="Delimiter">;</span>
 <span id="L230" class="LineNr">230 </span><span class="Delimiter">}</span>
 <span id="L231" class="LineNr">231 </span>
-<span id="L232" class="LineNr">232 </span><span class="SalientComment">//:: compare</span>
+<span id="L232" class="LineNr">232 </span><span class="SalientComment">//:: compare (cmp)</span>
 <span id="L233" class="LineNr">233 </span>
 <span id="L234" class="LineNr">234 </span><span class="Delimiter">:(scenario compare_imm32_with_eax_greater)</span>
 <span id="L235" class="LineNr">235 </span><span class="Special">% Reg[0].i = 0x0d0c0b0a;</span>
@@ -395,6 +395,41 @@ if ('onhashchange' in window) {
 <span id="L331" class="LineNr">331 </span><span class="traceContains">+run: combine <a href='010core.cc.html#L215'>imm32</a> 0x0d0c0b0a with effective address</span>
 <span id="L332" class="LineNr">332 </span><span class="traceContains">+run: effective address is mem at address 0x60 (reg 3)</span>
 <span id="L333" class="LineNr">333 </span><span class="traceContains">+run: SF=0; ZF=1; OF=0</span>
+<span id="L334" class="LineNr">334 </span>
+<span id="L335" class="LineNr">335 </span><span class="SalientComment">//:: copy (mov)</span>
+<span id="L336" class="LineNr">336 </span>
+<span id="L337" class="LineNr">337 </span><span class="Delimiter">:(scenario copy_imm32_to_r32)</span>
+<span id="L338" class="LineNr">338 </span><span class="Comment"># op  ModRM   SIB   displacement  immediate</span>
+<span id="L339" class="LineNr">339 </span>  b8  <span class="PreProc">0</span><span class="Constant">3</span>                          0a 0b 0c 0d  <span class="Comment"># copy 0x0d0c0b0a to EBX (reg 3)</span>
+<span id="L340" class="LineNr">340 </span><span class="traceContains">+run: copy <a href='010core.cc.html#L215'>imm32</a> 0x0d0c0b0a to <a href='010core.cc.html#L15'>reg</a> 3</span>
+<span id="L341" class="LineNr">341 </span>
+<span id="L342" class="LineNr">342 </span><span class="Delimiter">:(before &quot;End Single-Byte Opcodes&quot;)</span>
+<span id="L343" class="LineNr">343 </span><span class="Normal">case</span> <span class="Constant">0xb8</span>: <span class="Delimiter">{</span>  <span class="Comment">// copy imm32 to r32</span>
+<span id="L344" class="LineNr">344 </span>  <span class="Normal">uint8_t</span> modrm = <a href='010core.cc.html#L210'>next</a><span class="Delimiter">();</span>
+<span id="L345" class="LineNr">345 </span>  <span class="Normal">int32_t</span> arg2 = <a href='010core.cc.html#L215'>imm32</a><span class="Delimiter">();</span>
+<span id="L346" class="LineNr">346 </span>  <span class="Normal">uint8_t</span> reg1 = modrm&amp;<span class="Constant">0x7</span><span class="Delimiter">;</span>  <span class="Comment">// ignore mod bits</span>
+<span id="L347" class="LineNr">347 </span>  <a href='003trace.cc.html#L160'>trace</a><span class="Delimiter">(</span><span class="Constant">2</span><span class="Delimiter">,</span> <span class="Constant">&quot;run&quot;</span><span class="Delimiter">)</span> &lt;&lt; <span class="Constant">&quot;copy <a href='010core.cc.html#L215'>imm32</a> 0x&quot;</span> &lt;&lt; <a href='010core.cc.html#L226'>HEXWORD</a> &lt;&lt; arg2 &lt;&lt; <span class="Constant">&quot; to <a href='010core.cc.html#L15'>reg</a> &quot;</span> &lt;&lt; <a href='010core.cc.html#L228'>NUM</a><span class="Delimiter">(</span>reg1<span class="Delimiter">)</span> &lt;&lt; <a href='003trace.cc.html#L184'>end</a><span class="Delimiter">();</span>
+<span id="L348" class="LineNr">348 </span>  Reg[reg1]<span class="Delimiter">.</span><a href='010core.cc.html#L16'>i</a> = arg2<span class="Delimiter">;</span>
+<span id="L349" class="LineNr">349 </span>  <span class="Identifier">break</span><span class="Delimiter">;</span>
+<span id="L350" class="LineNr">350 </span><span class="Delimiter">}</span>
+<span id="L351" class="LineNr">351 </span>
+<span id="L352" class="LineNr">352 </span><span class="Comment">//:</span>
+<span id="L353" class="LineNr">353 </span><span class="Delimiter">:(scenario copy_imm32_to_mem_at_r32)</span>
+<span id="L354" class="LineNr">354 </span><span class="Special">% Reg[3].i = 0x60;</span>
+<span id="L355" class="LineNr">355 </span><span class="Comment"># op  ModRM   SIB   displacement  immediate</span>
+<span id="L356" class="LineNr">356 </span>  c7  <span class="PreProc">0</span><span class="Constant">3</span>                          0a 0b 0c 0d  <span class="Comment"># copy 0x0d0c0b0a to *EBX (reg 3)</span>
+<span id="L357" class="LineNr">357 </span><span class="traceContains">+run: copy <a href='010core.cc.html#L215'>imm32</a> 0x0d0c0b0a to effective address</span>
+<span id="L358" class="LineNr">358 </span><span class="traceContains">+run: effective address is mem at address 0x60 (reg 3)</span>
+<span id="L359" class="LineNr">359 </span>
+<span id="L360" class="LineNr">360 </span><span class="Delimiter">:(before &quot;End Single-Byte Opcodes&quot;)</span>
+<span id="L361" class="LineNr">361 </span><span class="Normal">case</span> <span class="Constant">0xc7</span>: <span class="Delimiter">{</span>  <span class="Comment">// copy imm32 to r32</span>
+<span id="L362" class="LineNr">362 </span>  <span class="Normal">uint8_t</span> modrm = <a href='010core.cc.html#L210'>next</a><span class="Delimiter">();</span>
+<span id="L363" class="LineNr">363 </span>  <span class="Normal">int32_t</span> arg2 = <a href='010core.cc.html#L215'>imm32</a><span class="Delimiter">();</span>
+<span id="L364" class="LineNr">364 </span>  <a href='003trace.cc.html#L160'>trace</a><span class="Delimiter">(</span><span class="Constant">2</span><span class="Delimiter">,</span> <span class="Constant">&quot;run&quot;</span><span class="Delimiter">)</span> &lt;&lt; <span class="Constant">&quot;copy <a href='010core.cc.html#L215'>imm32</a> 0x&quot;</span> &lt;&lt; <a href='010core.cc.html#L226'>HEXWORD</a> &lt;&lt; arg2 &lt;&lt; <span class="Constant">&quot; to effective address&quot;</span> &lt;&lt; <a href='003trace.cc.html#L184'>end</a><span class="Delimiter">();</span>
+<span id="L365" class="LineNr">365 </span>  <span class="Normal">int32_t</span>* arg1 = <a href='011direct_addressing.cc.html#L26'>effective_address</a><span class="Delimiter">(</span>modrm<span class="Delimiter">);</span>
+<span id="L366" class="LineNr">366 </span>  *arg1 = arg2<span class="Delimiter">;</span>
+<span id="L367" class="LineNr">367 </span>  <span class="Identifier">break</span><span class="Delimiter">;</span>
+<span id="L368" class="LineNr">368 </span><span class="Delimiter">}</span>
 </pre>
 </body>
 </html>
diff --git a/subx/011direct_addressing.cc b/subx/011direct_addressing.cc
index a12b5541..f474ac99 100644
--- a/subx/011direct_addressing.cc
+++ b/subx/011direct_addressing.cc
@@ -149,7 +149,7 @@ case 0xf7: {  // xor r32 with r/m32
   break;
 }
 
-//:: compare
+//:: compare (cmp)
 
 :(scenario compare_r32_with_r32_greater)
 % Reg[0].i = 0x0a0b0c0d;
@@ -193,3 +193,24 @@ case 0x39: {  // set SF if r/m32 < r32
 +run: compare reg 3 with effective address
 +run: effective address is reg 0
 +run: SF=0; ZF=1; OF=0
+
+//:: copy (mov)
+
+:(scenario copy_r32_to_r32)
+% Reg[3].i = 0xaf;
+# op  ModRM   SIB   displacement  immediate
+  89  d8                                      # copy EBX (reg 3) to EAX (reg 0)
++run: copy reg 3 to effective address
++run: effective address is reg 0
++run: storing 0x000000af
+
+:(before "End Single-Byte Opcodes")
+case 0x89: {  // copy r32 to r/m32
+  uint8_t modrm = next();
+  uint8_t reg2 = (modrm>>3)&0x7;
+  trace(2, "run") << "copy reg " << NUM(reg2) << " to effective address" << end();
+  int32_t* arg1 = effective_address(modrm);
+  *arg1 = Reg[reg2].i;
+  trace(2, "run") << "storing 0x" << HEXWORD << *arg1 << end();
+  break;
+}
diff --git a/subx/012indirect_addressing.cc b/subx/012indirect_addressing.cc
index 546df707..3b2944b2 100644
--- a/subx/012indirect_addressing.cc
+++ b/subx/012indirect_addressing.cc
@@ -193,7 +193,7 @@ case 0x33: {  // xor r/m32 with r32
 +run: effective address is mem at address 0x60 (reg 3)
 +run: storing 0xf0f0ff00
 
-//:: compare
+//:: compare (cmp)
 
 :(scenario compare_mem_at_r32_with_r32_greater)
 % Reg[0].i = 0x60;
@@ -272,3 +272,36 @@ case 0x3b: {  // set SF if r32 < r/m32
 +run: compare effective address with reg 3
 +run: effective address is mem at address 0x60 (reg 0)
 +run: SF=0; ZF=1; OF=0
+
+//:: copy (mov)
+
+:(scenario copy_r32_to_mem_at_r32)
+% Reg[3].i = 0xaf;
+% Reg[0].i = 0x60;
+# op  ModRM   SIB   displacement  immediate
+  89  18                                      # copy EBX (reg 3) to *EAX (reg 0)
++run: copy reg 3 to effective address
++run: effective address is mem at address 0x60 (reg 0)
++run: storing 0x000000af
+
+//:
+
+:(scenario copy_mem_at_r32_to_r32)
+% Reg[0].i = 0x60;
+% SET_WORD_IN_MEM(0x60, 0x000000af);
+# op  ModRM   SIB   displacement  immediate
+  8b  18                                      # copy *EAX (reg 0) to EBX (reg 3)
++run: copy effective address to reg 3
++run: effective address is mem at address 0x60 (reg 0)
++run: storing 0x000000af
+
+:(before "End Single-Byte Opcodes")
+case 0x8b: {  // copy r32 to r/m32
+  uint8_t modrm = next();
+  uint8_t reg1 = (modrm>>3)&0x7;
+  trace(2, "run") << "copy effective address to reg " << NUM(reg1) << end();
+  int32_t* arg2 = effective_address(modrm);
+  Reg[reg1].i = *arg2;
+  trace(2, "run") << "storing 0x" << HEXWORD << *arg2 << end();
+  break;
+}
diff --git a/subx/013immediate_addressing.cc b/subx/013immediate_addressing.cc
index c370217a..dd1ce4c0 100644
--- a/subx/013immediate_addressing.cc
+++ b/subx/013immediate_addressing.cc
@@ -229,7 +229,7 @@ case 6: {
   break;
 }
 
-//:: compare
+//:: compare (cmp)
 
 :(scenario compare_imm32_with_eax_greater)
 % Reg[0].i = 0x0d0c0b0a;
@@ -331,3 +331,38 @@ case 7: {
 +run: combine imm32 0x0d0c0b0a with effective address
 +run: effective address is mem at address 0x60 (reg 3)
 +run: SF=0; ZF=1; OF=0
+
+//:: copy (mov)
+
+:(scenario copy_imm32_to_r32)
+# op  ModRM   SIB   displacement  immediate
+  b8  03                          0a 0b 0c 0d  # copy 0x0d0c0b0a to EBX (reg 3)
++run: copy imm32 0x0d0c0b0a to reg 3
+
+:(before "End Single-Byte Opcodes")
+case 0xb8: {  // copy imm32 to r32
+  uint8_t modrm = next();
+  int32_t arg2 = imm32();
+  uint8_t reg1 = modrm&0x7;  // ignore mod bits
+  trace(2, "run") << "copy imm32 0x" << HEXWORD << arg2 << " to reg " << NUM(reg1) << end();
+  Reg[reg1].i = arg2;
+  break;
+}
+
+//:
+:(scenario copy_imm32_to_mem_at_r32)
+% Reg[3].i = 0x60;
+# op  ModRM   SIB   displacement  immediate
+  c7  03                          0a 0b 0c 0d  # copy 0x0d0c0b0a to *EBX (reg 3)
++run: copy imm32 0x0d0c0b0a to effective address
++run: effective address is mem at address 0x60 (reg 3)
+
+:(before "End Single-Byte Opcodes")
+case 0xc7: {  // copy imm32 to r32
+  uint8_t modrm = next();
+  int32_t arg2 = imm32();
+  trace(2, "run") << "copy imm32 0x" << HEXWORD << arg2 << " to effective address" << end();
+  int32_t* arg1 = effective_address(modrm);
+  *arg1 = arg2;
+  break;
+}