title: When does the cmp instruction modify the zf flag? [x86 MASM]
body: <p>Given that "...the Zero flag (ZF) is set when the result of an arithmetic or logical operation generates a result of zero", how does the cmp instruction interact with ZF?</p>
  
  <p>Given the following code snippet,</p>
  
  <pre><code>mov eax, 0
  mov edx, 1
  cmp eax, edx
  </code></pre>
  
  <p>how does cmp evaluate the two operands and what is ZF set to? If the operands were reversed (cmp edx, eax), then is ZF set to the same value as in the original statement?</p>
  
  <p>If I were to compare two identical values, how does cmp evaluate the operands and what is ZF set to?</p>
  
  <pre><code>cmp eax, eax
  </code></pre>