about summary refs log tree commit diff stats
path: root/html/subx/011direct_addressing.cc.html
diff options
context:
space:
mode:
Diffstat (limited to 'html/subx/011direct_addressing.cc.html')
-rw-r--r--html/subx/011direct_addressing.cc.html112
1 files changed, 59 insertions, 53 deletions
diff --git a/html/subx/011direct_addressing.cc.html b/html/subx/011direct_addressing.cc.html
index ba7a1e3b..7c348d47 100644
--- a/html/subx/011direct_addressing.cc.html
+++ b/html/subx/011direct_addressing.cc.html
@@ -287,59 +287,65 @@ if ('onhashchange' in window) {
 <span id="L222" class="LineNr">222 </span><span class="Special">% Reg[EBX].i = 0x0000000a;</span>
 <span id="L223" class="LineNr">223 </span><span class="Comment"># op  ModRM   SIB   displacement  immediate</span>
 <span id="L224" class="LineNr">224 </span>  <span class="Constant">53</span>                                          <span class="Comment"># push EBX (reg 3) to stack</span>
-<span id="L225" class="LineNr">225 </span><span class="traceContains">+run: push <a href='010core.cc.html#L17'>reg</a> 3</span>
-<span id="L226" class="LineNr">226 </span><span class="traceContains">+run: pushing value 0x0000000a</span>
-<span id="L227" class="LineNr">227 </span><span class="traceContains">+run: <a href='010core.cc.html#L11'>ESP</a> is now 0x00000060</span>
-<span id="L228" class="LineNr">228 </span><span class="traceContains">+run: <a href='003trace.cc.html#L74'>contents</a> at <a href='010core.cc.html#L11'>ESP</a>: 0x0000000a</span>
-<span id="L229" class="LineNr">229 </span>
-<span id="L230" class="LineNr">230 </span><span class="Delimiter">:(before &quot;End Single-Byte Opcodes&quot;)</span>
-<span id="L231" class="LineNr">231 </span><span class="Normal">case</span> <span class="Constant">0x50</span>:
-<span id="L232" class="LineNr">232 </span><span class="Normal">case</span> <span class="Constant">0x51</span>:
-<span id="L233" class="LineNr">233 </span><span class="Normal">case</span> <span class="Constant">0x52</span>:
-<span id="L234" class="LineNr">234 </span><span class="Normal">case</span> <span class="Constant">0x53</span>:
-<span id="L235" class="LineNr">235 </span><span class="Normal">case</span> <span class="Constant">0x54</span>:
-<span id="L236" class="LineNr">236 </span><span class="Normal">case</span> <span class="Constant">0x55</span>:
-<span id="L237" class="LineNr">237 </span><span class="Normal">case</span> <span class="Constant">0x56</span>:
-<span id="L238" class="LineNr">238 </span><span class="Normal">case</span> <span class="Constant">0x57</span>: <span class="Delimiter">{</span>  <span class="Comment">// push r32 to stack</span>
-<span id="L239" class="LineNr">239 </span>  <span class="Normal">uint8_t</span> <a href='010core.cc.html#L17'>reg</a> = op &amp; <span class="Constant">0x7</span><span class="Delimiter">;</span>
-<span id="L240" class="LineNr">240 </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;push <a href='010core.cc.html#L17'>reg</a> &quot;</span> &lt;&lt; <a href='010core.cc.html#L232'>NUM</a><span class="Delimiter">(</span><a href='010core.cc.html#L17'>reg</a><span class="Delimiter">)</span> &lt;&lt; <a href='003trace.cc.html#L184'>end</a><span class="Delimiter">();</span>
-<span id="L241" class="LineNr">241 </span>  <span class="Normal">const</span> <span class="Normal">int32_t</span> val = Reg[reg]<span class="Delimiter">.</span>u<span class="Delimiter">;</span>
-<span id="L242" class="LineNr">242 </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;pushing value 0x&quot;</span> &lt;&lt; <a href='010core.cc.html#L230'>HEXWORD</a> &lt;&lt; val &lt;&lt; <a href='003trace.cc.html#L184'>end</a><span class="Delimiter">();</span>
-<span id="L243" class="LineNr">243 </span>  Reg[ESP]<span class="Delimiter">.</span>u -= <span class="Constant">4</span><span class="Delimiter">;</span>
-<span id="L244" class="LineNr">244 </span>  *<span class="Normal">reinterpret_cast</span>&lt;<span class="Normal">uint32_t</span>*&gt;<span class="Delimiter">(</span>&amp;Mem<span class="Delimiter">.</span>at<span class="Delimiter">(</span>Reg[ESP]<span class="Delimiter">.</span>u<span class="Delimiter">))</span> = val<span class="Delimiter">;</span>
-<span id="L245" class="LineNr">245 </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;ESP is now 0x&quot;</span> &lt;&lt; <a href='010core.cc.html#L230'>HEXWORD</a> &lt;&lt; Reg[ESP]<span class="Delimiter">.</span>u &lt;&lt; <a href='003trace.cc.html#L184'>end</a><span class="Delimiter">();</span>
-<span id="L246" class="LineNr">246 </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;contents at <a href='010core.cc.html#L11'>ESP</a>: 0x&quot;</span> &lt;&lt; <a href='010core.cc.html#L230'>HEXWORD</a> &lt;&lt; *<span class="Normal">reinterpret_cast</span>&lt;<span class="Normal">uint32_t</span>*&gt;<span class="Delimiter">(</span>&amp;Mem<span class="Delimiter">.</span>at<span class="Delimiter">(</span>Reg[ESP]<span class="Delimiter">.</span>u<span class="Delimiter">))</span> &lt;&lt; <a href='003trace.cc.html#L184'>end</a><span class="Delimiter">();</span>
-<span id="L247" class="LineNr">247 </span>  <span class="Identifier">break</span><span class="Delimiter">;</span>
-<span id="L248" class="LineNr">248 </span><span class="Delimiter">}</span>
-<span id="L249" class="LineNr">249 </span>
-<span id="L250" class="LineNr">250 </span><span class="SalientComment">//:: pop</span>
-<span id="L251" class="LineNr">251 </span>
-<span id="L252" class="LineNr">252 </span><span class="Delimiter">:(scenario pop_r32)</span>
-<span id="L253" class="LineNr">253 </span><span class="Special">% Reg[ESP].u = 0x60;</span>
-<span id="L254" class="LineNr">254 </span><span class="Special">% SET_WORD_IN_MEM(0x60, 0x0000000a);</span>
-<span id="L255" class="LineNr">255 </span><span class="Comment"># op  ModRM   SIB   displacement  immediate</span>
-<span id="L256" class="LineNr">256 </span>  5b                                          <span class="Comment"># pop stack to EBX (reg 3)</span>
-<span id="L257" class="LineNr">257 </span><span class="traceContains">+run: pop into <a href='010core.cc.html#L17'>reg</a> 3</span>
-<span id="L258" class="LineNr">258 </span><span class="traceContains">+run: popping value 0x0000000a</span>
-<span id="L259" class="LineNr">259 </span><span class="traceContains">+run: <a href='010core.cc.html#L11'>ESP</a> is now 0x00000064</span>
-<span id="L260" class="LineNr">260 </span>
-<span id="L261" class="LineNr">261 </span><span class="Delimiter">:(before &quot;End Single-Byte Opcodes&quot;)</span>
-<span id="L262" class="LineNr">262 </span><span class="Normal">case</span> <span class="Constant">0x58</span>:
-<span id="L263" class="LineNr">263 </span><span class="Normal">case</span> <span class="Constant">0x59</span>:
-<span id="L264" class="LineNr">264 </span><span class="Normal">case</span> <span class="Constant">0x5a</span>:
-<span id="L265" class="LineNr">265 </span><span class="Normal">case</span> <span class="Constant">0x5b</span>:
-<span id="L266" class="LineNr">266 </span><span class="Normal">case</span> <span class="Constant">0x5c</span>:
-<span id="L267" class="LineNr">267 </span><span class="Normal">case</span> <span class="Constant">0x5d</span>:
-<span id="L268" class="LineNr">268 </span><span class="Normal">case</span> <span class="Constant">0x5e</span>:
-<span id="L269" class="LineNr">269 </span><span class="Normal">case</span> <span class="Constant">0x5f</span>: <span class="Delimiter">{</span>  <span class="Comment">// pop stack into r32</span>
-<span id="L270" class="LineNr">270 </span>  <span class="Normal">uint8_t</span> <a href='010core.cc.html#L17'>reg</a> = op &amp; <span class="Constant">0x7</span><span class="Delimiter">;</span>
-<span id="L271" class="LineNr">271 </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;pop into <a href='010core.cc.html#L17'>reg</a> &quot;</span> &lt;&lt; <a href='010core.cc.html#L232'>NUM</a><span class="Delimiter">(</span><a href='010core.cc.html#L17'>reg</a><span class="Delimiter">)</span> &lt;&lt; <a href='003trace.cc.html#L184'>end</a><span class="Delimiter">();</span>
-<span id="L272" class="LineNr">272 </span>  Reg[reg]<span class="Delimiter">.</span>u = *<span class="Normal">reinterpret_cast</span>&lt;<span class="Normal">uint32_t</span>*&gt;<span class="Delimiter">(</span>&amp;Mem<span class="Delimiter">.</span>at<span class="Delimiter">(</span>Reg[ESP]<span class="Delimiter">.</span>u<span class="Delimiter">));</span>
-<span id="L273" class="LineNr">273 </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;popping value 0x&quot;</span> &lt;&lt; <a href='010core.cc.html#L230'>HEXWORD</a> &lt;&lt; Reg[reg]<span class="Delimiter">.</span>u &lt;&lt; <a href='003trace.cc.html#L184'>end</a><span class="Delimiter">();</span>
-<span id="L274" class="LineNr">274 </span>  Reg[ESP]<span class="Delimiter">.</span>u += <span class="Constant">4</span><span class="Delimiter">;</span>
-<span id="L275" class="LineNr">275 </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;ESP is now 0x&quot;</span> &lt;&lt; <a href='010core.cc.html#L230'>HEXWORD</a> &lt;&lt; Reg[ESP]<span class="Delimiter">.</span>u &lt;&lt; <a href='003trace.cc.html#L184'>end</a><span class="Delimiter">();</span>
-<span id="L276" class="LineNr">276 </span>  <span class="Identifier">break</span><span class="Delimiter">;</span>
-<span id="L277" class="LineNr">277 </span><span class="Delimiter">}</span>
+<span id="L225" class="LineNr">225 </span><span class="traceContains">+run: <a href='011direct_addressing.cc.html#L244'>push</a> <a href='010core.cc.html#L17'>reg</a> 3</span>
+<span id="L226" class="LineNr">226 </span><span class="traceContains">+run: decrementing <a href='010core.cc.html#L11'>ESP</a> to 0x00000060</span>
+<span id="L227" class="LineNr">227 </span><span class="traceContains">+run: pushing value 0x0000000a</span>
+<span id="L228" class="LineNr">228 </span>
+<span id="L229" class="LineNr">229 </span><span class="Delimiter">:(before &quot;End Single-Byte Opcodes&quot;)</span>
+<span id="L230" class="LineNr">230 </span><span class="Normal">case</span> <span class="Constant">0x50</span>:
+<span id="L231" class="LineNr">231 </span><span class="Normal">case</span> <span class="Constant">0x51</span>:
+<span id="L232" class="LineNr">232 </span><span class="Normal">case</span> <span class="Constant">0x52</span>:
+<span id="L233" class="LineNr">233 </span><span class="Normal">case</span> <span class="Constant">0x53</span>:
+<span id="L234" class="LineNr">234 </span><span class="Normal">case</span> <span class="Constant">0x54</span>:
+<span id="L235" class="LineNr">235 </span><span class="Normal">case</span> <span class="Constant">0x55</span>:
+<span id="L236" class="LineNr">236 </span><span class="Normal">case</span> <span class="Constant">0x56</span>:
+<span id="L237" class="LineNr">237 </span><span class="Normal">case</span> <span class="Constant">0x57</span>: <span class="Delimiter">{</span>  <span class="Comment">// push r32 to stack</span>
+<span id="L238" class="LineNr">238 </span>  <span class="Normal">uint8_t</span> <a href='010core.cc.html#L17'>reg</a> = op &amp; <span class="Constant">0x7</span><span class="Delimiter">;</span>
+<span id="L239" class="LineNr">239 </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;push <a href='010core.cc.html#L17'>reg</a> &quot;</span> &lt;&lt; <a href='010core.cc.html#L232'>NUM</a><span class="Delimiter">(</span><a href='010core.cc.html#L17'>reg</a><span class="Delimiter">)</span> &lt;&lt; <a href='003trace.cc.html#L184'>end</a><span class="Delimiter">();</span>
+<span id="L240" class="LineNr">240 </span>  <a href='011direct_addressing.cc.html#L244'>push</a><span class="Delimiter">(</span>Reg[reg]<span class="Delimiter">.</span>u<span class="Delimiter">);</span>
+<span id="L241" class="LineNr">241 </span>  <span class="Identifier">break</span><span class="Delimiter">;</span>
+<span id="L242" class="LineNr">242 </span><span class="Delimiter">}</span>
+<span id="L243" class="LineNr">243 </span><span class="Delimiter">:(code)</span>
+<span id="L244" class="LineNr">244 </span><span class="Normal">void</span> <a href='011direct_addressing.cc.html#L244'>push</a><span class="Delimiter">(</span><span class="Normal">uint32_t</span> val<span class="Delimiter">)</span> <span class="Delimiter">{</span>
+<span id="L245" class="LineNr">245 </span>  Reg[ESP]<span class="Delimiter">.</span>u -= <span class="Constant">4</span><span class="Delimiter">;</span>
+<span id="L246" class="LineNr">246 </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;decrementing <a href='010core.cc.html#L11'>ESP</a> to 0x&quot;</span> &lt;&lt; <a href='010core.cc.html#L230'>HEXWORD</a> &lt;&lt; Reg[ESP]<span class="Delimiter">.</span>u &lt;&lt; <a href='003trace.cc.html#L184'>end</a><span class="Delimiter">();</span>
+<span id="L247" class="LineNr">247 </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;pushing value 0x&quot;</span> &lt;&lt; <a href='010core.cc.html#L230'>HEXWORD</a> &lt;&lt; val &lt;&lt; <a href='003trace.cc.html#L184'>end</a><span class="Delimiter">();</span>
+<span id="L248" class="LineNr">248 </span>  *<span class="Normal">reinterpret_cast</span>&lt;<span class="Normal">uint32_t</span>*&gt;<span class="Delimiter">(</span>&amp;Mem<span class="Delimiter">.</span>at<span class="Delimiter">(</span>Reg[ESP]<span class="Delimiter">.</span>u<span class="Delimiter">))</span> = val<span class="Delimiter">;</span>
+<span id="L249" class="LineNr">249 </span><span class="Delimiter">}</span>
+<span id="L250" class="LineNr">250 </span>
+<span id="L251" class="LineNr">251 </span><span class="SalientComment">//:: pop</span>
+<span id="L252" class="LineNr">252 </span>
+<span id="L253" class="LineNr">253 </span><span class="Delimiter">:(scenario pop_r32)</span>
+<span id="L254" class="LineNr">254 </span><span class="Special">% Reg[ESP].u = 0x60;</span>
+<span id="L255" class="LineNr">255 </span><span class="Special">% SET_WORD_IN_MEM(0x60, 0x0000000a);</span>
+<span id="L256" class="LineNr">256 </span><span class="Comment"># op  ModRM   SIB   displacement  immediate</span>
+<span id="L257" class="LineNr">257 </span>  5b                                          <span class="Comment"># pop stack to EBX (reg 3)</span>
+<span id="L258" class="LineNr">258 </span><span class="traceContains">+run: <a href='011direct_addressing.cc.html#L277'>pop</a> into <a href='010core.cc.html#L17'>reg</a> 3</span>
+<span id="L259" class="LineNr">259 </span><span class="traceContains">+run: popping value 0x0000000a</span>
+<span id="L260" class="LineNr">260 </span><span class="traceContains">+run: incrementing <a href='010core.cc.html#L11'>ESP</a> to 0x00000064</span>
+<span id="L261" class="LineNr">261 </span>
+<span id="L262" class="LineNr">262 </span><span class="Delimiter">:(before &quot;End Single-Byte Opcodes&quot;)</span>
+<span id="L263" class="LineNr">263 </span><span class="Normal">case</span> <span class="Constant">0x58</span>:
+<span id="L264" class="LineNr">264 </span><span class="Normal">case</span> <span class="Constant">0x59</span>:
+<span id="L265" class="LineNr">265 </span><span class="Normal">case</span> <span class="Constant">0x5a</span>:
+<span id="L266" class="LineNr">266 </span><span class="Normal">case</span> <span class="Constant">0x5b</span>:
+<span id="L267" class="LineNr">267 </span><span class="Normal">case</span> <span class="Constant">0x5c</span>:
+<span id="L268" class="LineNr">268 </span><span class="Normal">case</span> <span class="Constant">0x5d</span>:
+<span id="L269" class="LineNr">269 </span><span class="Normal">case</span> <span class="Constant">0x5e</span>:
+<span id="L270" class="LineNr">270 </span><span class="Normal">case</span> <span class="Constant">0x5f</span>: <span class="Delimiter">{</span>  <span class="Comment">// pop stack into r32</span>
+<span id="L271" class="LineNr">271 </span>  <span class="Normal">uint8_t</span> <a href='010core.cc.html#L17'>reg</a> = op &amp; <span class="Constant">0x7</span><span class="Delimiter">;</span>
+<span id="L272" class="LineNr">272 </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;pop into <a href='010core.cc.html#L17'>reg</a> &quot;</span> &lt;&lt; <a href='010core.cc.html#L232'>NUM</a><span class="Delimiter">(</span><a href='010core.cc.html#L17'>reg</a><span class="Delimiter">)</span> &lt;&lt; <a href='003trace.cc.html#L184'>end</a><span class="Delimiter">();</span>
+<span id="L273" class="LineNr">273 </span>  Reg[reg]<span class="Delimiter">.</span>u = <a href='011direct_addressing.cc.html#L277'>pop</a><span class="Delimiter">();</span>
+<span id="L274" class="LineNr">274 </span>  <span class="Identifier">break</span><span class="Delimiter">;</span>
+<span id="L275" class="LineNr">275 </span><span class="Delimiter">}</span>
+<span id="L276" class="LineNr">276 </span><span class="Delimiter">:(code)</span>
+<span id="L277" class="LineNr">277 </span><span class="Normal">uint32_t</span> <a href='011direct_addressing.cc.html#L277'>pop</a><span class="Delimiter">()</span> <span class="Delimiter">{</span>
+<span id="L278" class="LineNr">278 </span>  <span class="Normal">uint32_t</span> result = *<span class="Normal">reinterpret_cast</span>&lt;<span class="Normal">uint32_t</span>*&gt;<span class="Delimiter">(</span>&amp;Mem<span class="Delimiter">.</span>at<span class="Delimiter">(</span>Reg[ESP]<span class="Delimiter">.</span>u<span class="Delimiter">));</span>
+<span id="L279" class="LineNr">279 </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;popping value 0x&quot;</span> &lt;&lt; <a href='010core.cc.html#L230'>HEXWORD</a> &lt;&lt; result &lt;&lt; <a href='003trace.cc.html#L184'>end</a><span class="Delimiter">();</span>
+<span id="L280" class="LineNr">280 </span>  Reg[ESP]<span class="Delimiter">.</span>u += <span class="Constant">4</span><span class="Delimiter">;</span>
+<span id="L281" class="LineNr">281 </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;incrementing <a href='010core.cc.html#L11'>ESP</a> to 0x&quot;</span> &lt;&lt; <a href='010core.cc.html#L230'>HEXWORD</a> &lt;&lt; Reg[ESP]<span class="Delimiter">.</span>u &lt;&lt; <a href='003trace.cc.html#L184'>end</a><span class="Delimiter">();</span>
+<span id="L282" class="LineNr">282 </span>  <span class="Identifier">return</span> result<span class="Delimiter">;</span>
+<span id="L283" class="LineNr">283 </span><span class="Delimiter">}</span>
 </pre>
 </body>
 </html>