title: Assembly atoi function
body: <p>I am making atoi function for assembly.<br>
  Whatever I try it doesn't work and I have no idea why.</p>
  
  <p>Does anyone know what is the problem?</p>
  
  <pre><code>org 100h
  
  mov si, stri     ;parameter
  call atoi        ;call function
  pop eax          ;result
  mov [broj], eax  ;save
  mov ah, 9        ;display (in ascii, because I don't have itoa function yet either)
  mov dx, broj
  int 21h
  
  mov ah, 8
  int 21h
  int 20h
  
  atoi:
      mov eax, 0 ;stores result
      mov ebx, 0 ;stores character
  atoi_start:
      mov bl, [si] ;get character
      cmp bl, '$' ;till dollar sign
      je end_atoi
      imul eax, 10 ;multiplu by 10
      sub bl, 30h ;ascii to int
      add eax, ebx ;and add the new digit
      inc si ;;next char
  jmp atoi_start
  end_atoi:
      push eax ;return value
      ret
  
  stri db '1000$'
  broj: db ?,?, '$'
  </code></pre>