title: How to implement in-line assembly "for" loop in Arduino for faster delayMicros function
body: <p>I'm trying to make a more precise version of the Arduino's delayMicroseconds() function, the ultimate goal being a square-wave generator whose frequency can be varied up to 100 KHz with a precision of 0.2 KHz. </p>
  
  <p>Based on the resources I found online, this was my best attempt:</p>
  
  <pre><code>  __asm__ ("mov eax, $x");
    __asm__("beginning:");
    __asm__("inc eax");
    __asm__("cmp eax, 0x0A");
    __asm__("jne beginning");
    __asm__("mov $x, eax");
  </code></pre>
  
  <p>I inputted the above code into the Arduino IDE and hit "verify;" the following error messages appeared: </p>
  
  <pre><code>Arduino: 1.6.4 (Windows 7), Board: "Arduino Uno"
  
  C:\Users\212455~1\AppData\Local\Temp\cciNDaW0.s: Assembler messages:
  C:\Users\212455~1\AppData\Local\Temp\cciNDaW0.s:46: Error: constant value required
   C:\Users\212455~1\AppData\Local\Temp\cciNDaW0.s:46: Error: constant value required
  C:\Users\212455~1\AppData\Local\Temp\cciNDaW0.s:46: Error: unknown opcode `x'
  C:\Users\212455~1\AppData\Local\Temp\cciNDaW0.s:54: Error: constant value required
  C:\Users\212455~1\AppData\Local\Temp\cciNDaW0.s:58: Error: unknown opcode `cmp'
  C:\Users\212455~1\AppData\Local\Temp\cciNDaW0.s:62: Error: unknown opcode `jne'
  C:\Users\212455~1\AppData\Local\Temp\cciNDaW0.s:66: Error: constant value required
  C:\Users\212455~1\AppData\Local\Temp\cciNDaW0.s:66: Error: `,' required
  C:\Users\212455~1\AppData\Local\Temp\cciNDaW0.s:66: Error: constant value required
  C:\Users\212455~1\AppData\Local\Temp\cciNDaW0.s:66: Error: garbage at end of line
  C:\Users\212455~1\AppData\Local\Temp\cciNDaW0.s:66: Error: unknown opcode `x'
  Error compiling.
  
  This report would have more information with "Show verbose output during compilation" enabled in File &gt; Preferences.
  </code></pre>
  
  <p>What should I do?</p>