title: Segmentation fault when trying to sort string elements
body: <p>I'm trying to make a program that takes a string as an input (made up of 0,1, and 2), and checks if the string[i+1] element is greater than string[i]. if it is greater, the program returns 1, if it is not greater, it returns -1. I keep getting a segmentation fault and i have no idea where it could be. </p>
  
  <p>There is more code to the rest of the program but i have confirmed that the rest works and only raises a Seg Fault when "sort" is called.</p>
  
  <p>My code:</p>
  
  <pre><code>sort:  
  enter 0,0
  pusha
  
  mov edx, dword [ebp+8]        ;address of string
  mov edi, dword [ebp+12]       ;first index
  mov esi, dword [ebp+16]       ;second index
  LOOPYDOOPY:
    cmp byte [edx+edi], 0       ;check if the character at first index is 0
    je RETMINUS                                                   
    cmp byte [edx+esi], 0       ;if character at second is 0
    je RETPLUS
    mov al, byte [edx+esi]      ;if first element is greater than second element
    cmp byte [edx+edi], al
    jl RETMINUS
    cmp byte [edx+edi], al      ;firstt &lt; second
    jg RETPLUS
    inc edi
    inc esi
    jmp LOOPYDOOPY
  RETPLUS:
    popa
    mov eax, 1                  ;return 1
    jmp END
  RETMINUS:
    popa
    mov eax, -1                 ;return -1
  END:
    leave
    ret
  </code></pre>