title: How does comparing the Sign and Overflow Flag determine operand relationships?
body: <p>Jump's based on comparing signed integers use the Zero, Sign, and Overflow flag to determine the relationship between operands. After <code>CMP</code> with two signed operands, there are three possible scenario's:</p>
  
  <ol>
  <li><code>ZF = 1</code> - Destination = Source</li>
  <li><code>SF = OF</code> - Destination > Source</li>
  <li><code>SF != OF</code> - Destination &lt; Source</li>
  </ol>
  
  <p>I'm having trouble understanding scenario 2 and 3.  I've worked through the possible combinations and see that they do work - but I still can't figure out why they work. </p>
  
  <p>Can anyone explain why a comparison of the Sign and Overflow flags reflects signed integer relationships? </p>
  
  <p><strong>Edit:</strong> </p>
  
  <p>There seems to be some understanding regarding what I'm asking. Jumps based on signed comparisons utilize the Zero, Sign, and Carry flag - these include <code>JG</code>, <code>JL</code>, and so on. </p>
  
  <p>For example:</p>
  
  <pre><code>mov   al, 1
  cmp   al, -1    
  jg    isGreater
  
  isGreater: 
  </code></pre>
  
  <p>The jump is taken because Overflow flag = Sign Flag (both are 0), indicating in terms of signed comparison, the destination operand is larger than the source. </p>
  
  <p>If the Overflow flag was set to 1 and the Sign flag set to 0, that would indicate the destination is smaller.  </p>
  
  <p>My questions is - I just can't seem to wrap my head around WHY this actually works. </p>