title: How would I find the length of a string using NASM?
body: <p>I'm trying to make a program using NASM that takes input from command line arguments. Since string length is not provided, I'm trying to make a function to compute my own. Here is my attempt, which takes a pointer to a string in the <code>ebx</code> register, and returns the length of the string in <code>ecx</code>:</p>
  
  <pre><code>len:
      push ebx
      mov ecx,0
      dec ebx
      count:
          inc ecx
          inc ebx
          cmp ebx,0
          jnz count
      dec ecx
      pop ebx
      ret
  </code></pre>
  
  <p>My method is to go through the string, character by character, and check if it's null. If it's not, I increment <code>ecx</code> and go to the next character. I believe the problem is that <code>cmp ebx,0</code> is incorrect for what I'm trying to do. How would I properly go about checking whether the character is null? Also, are there other things that I could be doing better?</p>