title: Writing a while loop in assembly
body: <p>I'm trying to write a while loop in assembly with a 6502 processor and I cannot figure out how to write the hexadecimal code. I've seen examples written using the shorthand where there is a label for where the loop should begin and end but I do not see anything for the actual hex code. </p>
  
  <p>The two codes I see being useful are:</p>
  
  <ol>
  <li>Comparing a byte in memory to the X reg (shorthand: CPX, hex: EC). This sets the Z flag to zero if equal and</li>
  <li>Branch X bytes if Z flag = 0 (shorthand: BNE, hex: D0) </li>
  </ol>