Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <pre><code>XOR CX, CX ;0x31 0xC9 </code></pre> <p>Uses only two bytes: opcode <code>0x31</code> and ModR/M byte that stores source and destination register (in this case these two are same).</p> <pre><code>MOV CX, 0 ;0xB8 0x08 0x00 0x00 </code></pre> <p>Needs more bytes: opcode <code>0xB8</code>, ModR/M for destination (in this case CX) and two byte immediate filled with zeroes. There is no difference from clocking perspective (both take only one clock), but <code>mov</code> needs 4 bytes while <code>xor</code> uses only two. </p> <pre><code>OR AX, AX ;0x0A 0xC0 </code></pre> <p>again uses only opcode byte and ModRM byte, while</p> <pre><code>CMP AX, 0 ;0x3D 0x00 0x00 &lt;-- but usually 0x3B ModRM 0x00 0x00 </code></pre> <p>uses three or four bytes. In this case it uses three bytes (opcode <code>0x3D</code>, word immediate representing zero) because x86 has special opcodes for some operations with Accumulator register, but normally it would use four bytes (opcode, ModR/M, word immediate). It's again the same when talking about CPU clocks. </p> <p>There's no difference to processor when executing</p> <pre><code>AND AL, 0x0F ;0x24 0x0F &lt;-- again special opcode for Accumulator </code></pre> <p>and</p> <pre><code>SUB AL, '0' ;0x2D 0x30 0x00 &lt;-- again special opcode for Accumulator </code></pre> <p>(only one byte difference), but when you substract ASCII zero, you can't be sure that there won't remain value greater than <code>9</code> in Accumulator. Also anding sets <code>OF</code> and <code>CF</code> to zero, while <code>sub</code> sets them according to the result <code>AND</code>ing can be safer, but my personal opinion is that this usage depends on context. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload