home *** CD-ROM | disk | FTP | other *** search
/ GEMini Atari / GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso / files / language / nasm20 / nasm20s / atoi.s65 < prev    next >
Encoding:
Text File  |  1993-10-23  |  533 b   |  29 lines

  1.    .include #16bit
  2.    
  3.    .zext _string1
  4.    .zext _value
  5.  
  6. ; --------------------------------------------------------------
  7. ;     This is just like ATOU but also converts the sign, if it
  8. ;     exists _string1 will point to the string after the sign
  9. ; --------------------------------------------------------------
  10. atoi:
  11.    ldy   #0
  12.    lda   (_string1),y
  13.    cmp   #'+
  14.    beq   :plus
  15.    cmp   #'-
  16.    beq   :minus
  17.    jmp   atou
  18.    
  19. :plus
  20.    inc.w _string1
  21.    jmp   atou
  22.    
  23. :minus
  24.    inc.w _string1
  25.    jsr   atou
  26.    neg.w _value
  27.    rts
  28.  
  29.