title: carry/overflow & subtraction in x86
body: <p>I'm trying to wrap my head around overflow &amp; carry flags in x86. </p>
  
  <p>As I understand it, for addition of signed 2's complement numbers, the flags can only be generated in one of four ways (my examples are 4-bit numbers):</p>
  
  <ol>
  <li>pos+pos = neg (overflow)
  <ul>
  <li>0111 + 0001 = 1000 (7 + 1 = -8)</li>
  </ul></li>
  <li>pos+neg = pos (carry)
  <ul>
  <li>0011 + 1110 = 0001 (3 + -2 = 1)</li>
  </ul></li>
  <li>neg+neg = neg (carry)
  <ul>
  <li>1111 + 1111 = 1110 (-1 + -1 = -2)</li>
  </ul></li>
  <li>neg+neg = pos (overflow &amp; carry)
  <ul>
  <li>1000 + 1001 = 0001 (-8 + -7 = 1)</li>
  </ul></li>
  </ol>
  
  <p>So, in x86 assembly, does subracting B from A generate the same flags as adding A and -B?</p>