title: If else OR statement in Assembly?
body: <p>Confused on using branching commands in Assembly, mostly just <code>BNE</code>, and <code>BEQ</code>.
  So I have to write an assembly code for the pseudo-code:</p>
  
  <pre><code>X = 5, Y = 10, Z = 15
  
  if X != 4 &amp;&amp; Y == 10 || Z = 20 
  
  A = X + Y - 2
  
  else   R = Z - 5 + X
  </code></pre>
  
  <p>I'm coding in <strong>Keil uVision5 for an ARM Cortex M0 Plus</strong> (No clue if this is needed info) within its low registers which are R0-R7 for this specific board.</p>
  
  <p>I know how I'd write the <code>if else</code> statement itself but I'm mainly asking how I'd go about with the <code>OR</code> part of the code. Obvious <code>X!=4</code> is true, and <code>Y==10</code> would be true,  and then check if <code>Z = 20</code> which is false, so would I check if <code>X!=4</code> first, jump using a <code>BNE</code> label to check Y, use a <code>BEQ</code> to check Z, which is false, but since the equation is true already I'd jump to a <code>BNE</code> endif statement for <code>A=X+Y-2</code>?</p>
  
  <p>and then in between with no label in front of it I'd write the else statement for the assembler to go to if the first BNE label was somehow false..?</p>
  
  <pre><code>A EQU 0x2000000
  R EQU 0x2000004
  X EQU 0x2000008
  Y EQU 0x200000C
  Z EQU 0x2000010
  
   LDR R7, =X
   LDR R0, [R7]
   ADD R0, #5  ; X = 5 in R0
   CMP R0, #4  ; Compare X != 4
   BNE jumpToY
  
  jumpToY
   LDR R7, =Y
   LDR R1, [R7]   ; Y = 10 in R1
   CMP R1, #10    ; Compare Y == 10
   BEQ jumpToZ
  
  jumpToZ
   etc...
  </code></pre>