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

  1. stdlib        segment    para public 'slcode'
  2.         assume    cs:stdlib
  3. ;
  4. ;
  5. ; strcatl- Appends one string to the end of another.
  6. ;
  7. ; inputs:
  8. ;
  9. ;    ES:DI-  Points at destination string, the one to which the follow
  10. ;            string will be appended.
  11. ;
  12. ;    CS:RET    Points at the follow string.
  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_strcatl
  19. ;
  20. sl_strcatl    proc    far
  21.         push    bp
  22.         mov    bp, sp
  23.         push    ds
  24.         push    cx
  25.         push    ax
  26.         pushf
  27.         push    si
  28.         push    di
  29. ;
  30.         cld
  31. ;
  32. ; Find the end of the destination string:
  33. ;
  34.         mov    al, 0
  35.         mov    cx, 0ffffh
  36.     repne    scasb
  37. ;
  38. ; Copy the second string to the end of the current string.
  39. ;
  40.         lds    si, 2[bp]        ;Get Return Address
  41.         dec    di
  42. CpyLp:        lodsb
  43.         stosb
  44.         cmp    al, 0
  45.         jnz    CpyLp
  46. ;
  47.         mov    2[bp], si        ;Save new return address.
  48.         pop    di
  49.         pop    si
  50.         popf
  51.         pop    ax
  52.         pop    cx
  53.         pop    ds
  54.         pop    bp
  55.         ret
  56. sl_strcatl    endp
  57. ;
  58. ;
  59. stdlib        ends
  60.         end
  61.