home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS - Coast to Coast / simteldosarchivecoasttocoast2.iso / asmutil / stdlib.zip / STRCAT.ASM < prev    next >
Assembly Source File  |  1990-07-14  |  893b  |  57 lines

  1. stdlib        segment    para public 'slcode'
  2.         assume    cs:stdlib
  3. ;
  4. ;
  5. ; strcat- Appends one string to the end of another.
  6. ;
  7. ; inputs:
  8. ;
  9. ;    ES:DI- Points at destination string, the one to which the source
  10. ;           string will be appended.
  11. ;
  12. ;    DX:DI- Points at the string to append.
  13. ;
  14. ;
  15. ; Note: The destination string's (ES:DI) buffer must be sufficiently large
  16. ;    to hold the result of the concatentation of the two strings.
  17. ;
  18.         public    sl_strcat
  19. ;
  20. sl_strcat    proc    far
  21.         push    ds
  22.         push    cx
  23.         push    ax
  24.         pushf
  25.         push    si
  26.         push    di
  27. ;
  28.         mov    ds, dx
  29.         cld
  30. ;
  31. ; Find the end of the destination string:
  32. ;
  33.         mov    al, 0
  34.         mov    cx, 0ffffh
  35.     repne    scasb
  36. ;
  37. ; Copy the second string to the end of the current string.
  38. ;
  39.         dec    di
  40. CpyLp:        lodsb
  41.         stosb
  42.         cmp    al, 0
  43.         jnz    CpyLp
  44. ;
  45.         pop    di
  46.         pop    si
  47.         popf
  48.         pop    ax
  49.         pop    cx
  50.         pop    ds
  51.         ret
  52. sl_strcat    endp
  53. ;
  54. ;
  55. stdlib        ends
  56.         end
  57.