title: How to find N,C,Z,V flags after the execution of this ARM assembly code program?
body: <p>Giving the following ARM assembly code, find the the output of the ALU flags [Negative, Carry out, Zero, oVerflow]<br></p>
  
  <pre><code>MOV R0 #00000100
  MOV R1 #00000100
  MOV R2 #0000010A
  CMP R0, R1
  SUBGES R0, R0, R2
  ADDLTS R0, R1, R2 
  </code></pre>
  
  <p>The correct answer should be N=1 ; C=V=Z=0 but I'm not sure about it. Also, I'm not even sure if <code>#00000100</code> is binary, decimal or hexadecimal.<br>
  Anyways, considering all of them hexadecimal, I'm proceeding in this way:<br></p>
  
  <pre><code>CMP R0 R1
  </code></pre>
  
  <p>Gives as ALU flags Z=1 and C=V=N=0.<br></p>
  
  <pre><code>SUBGES R0, R0, R2
  </code></pre>
  
  <p>performs a subtracion if "Greater or equal" (checks if N==V). Since N=V,<br> <em>R0-R2 = 256 - 266 = -10</em><br>
  Recall that "S" uodates flags, N=1, C=Z=V=0.<br></p>
  
  <pre><code>ADDLTS R0, R1, R2
  </code></pre>
  
  <p>performs an addition if "Less Than" (checks if N!=V). Since N!=V, <br>
  <em>R1 + R2 = 256 + 266 = 522</em><br>
  It means that <strong>N=C=Z=V=0</strong>.<br>
  Where am I wrong? </p>