title: How to get equal numer in assembly
body: <p>I have to find in array-pole number - x and return index(in it is on first the 0, second 1 ...). In SASM it stops in for loop and gives me SEG foult. How can I fix it?
  ...........................................................................................................................................................................................................................................................................................................................................................................................</p>
  <pre><code>
  section .data
  pole dd 1,2,8,0,
  x dd 8
  
  section .text
  
  
  CMAIN:        
      push ebp
      mov ebp, esp
      
      mov edx, [x] 
      mov ebx, pole
      push ebx
  
      call find_equal
      add esp, 4
      
      call WriteInt32
      pop ebp
      ret
    
   fac:
      push ebp
      mov ebp, esp
  
      mov eax, [esp+8]
      mov ebx, eax
      jmp .for
      .for:
      dec ebx
      mul ebx
      cmp ebx, 1
      je .end
      jmp .for
      
      .end:
       pop ebp
       ret 
       
  find_equal:
      push ebp
      mov ebp, esp
      mov ecx, [esp+8] ; pole
      mov eax, 0
      
      jmp .for1
      
      .for1:
          mov ecx, [ecx]
          cmp edx, ecx
          je .end1
          inc eax
          mov ecx, [ecx+4*eax]
          jmp .for1
          
          
          
      .end1:
       pop ebp
       ret 
       ```
  </code></pre>