   .include #16bit
   
   .zext _string1
   .zext _value

; --------------------------------------------------------------
;     This is just like ATOU but also converts the sign, if it
;     exists _string1 will point to the string after the sign
; --------------------------------------------------------------
atoi:
   ldy   #0
   lda   (_string1),y
   cmp   #'+
   beq   :plus
   cmp   #'-
   beq   :minus
   jmp   atou
   
:plus
   inc.w _string1
   jmp   atou
   
:minus
   inc.w _string1
   jsr   atou
   neg.w _value
   rts

