title: How to print index position x86 Assemby
body: <p>I am new to Assembly and trying to get a homework done, I want to know how to print the index position of an array instead of the value at index, I'm using ESI as pointer. Here the array is filled with 0's and 1's and I want to print the index of the 1's only.
  Sample array [1|1|0|0|1]</p>
  
  <pre><code>PRINT:  
      mov eax,[esi]
      cmp eax,1
      je Show
      add esi,4
      loop PRINT
  Show:   
      call WriteDec
      call Crlf
      loop Show
  </code></pre>
  
  <p>Output should be (1 2 5) or (0 1 4).
  Thanks.</p>