home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS - Coast to Coast / simteldosarchivecoasttocoast2.iso / asmutil / stdlib.zip / STRCPYL.ASM < prev    next >
Assembly Source File  |  1990-10-18  |  961b  |  66 lines

  1. stdlib        segment    para public 'slcode'
  2.         assume    cs:stdlib
  3. ;
  4. ;
  5. ; strcpyl- Copies string pointed at by cs:rtnadrs to dx:si.
  6. ;
  7. ;
  8. ; inputs:
  9. ;        cs:rtn-    Zero-terminated source string.
  10. ;        dx:si-  Buffer for destination string.
  11. ; outputs:
  12. ;        dx:si-    Still points at destination string.
  13. ;
  14. ;
  15. ; Note: The destination buffer must be large enough to hold the string and
  16. ;    zero terminating byte.
  17. ;
  18.         public    sl_strcpyl
  19. ;
  20. rtnadrs        equ    6[bp]
  21. destptr        equ    2[bp]
  22. ;
  23. sl_strcpyl    proc    far
  24.         push    dx
  25.         push    si
  26.         push    bp
  27.         mov    bp, sp
  28.         push    ds
  29.         push    es
  30.         push    di
  31.         push    cx
  32.         push    ax
  33.         pushf
  34. ;
  35.         cld
  36.         mov    al, 0
  37.         mov    cx, 0ffffh
  38.         les    di, rtnadrs
  39.     repne    scasb
  40.         lds    si, rtnadrs
  41.         mov    rtnadrs, di
  42.         les    di, destptr
  43.         neg    cx
  44.         dec    cx
  45.         shr    cx, 1
  46.         jnc    CpyWrd
  47.         lodsb
  48.         stosb
  49. CpyWrd:    rep    movsw
  50. ;
  51. DidByte:    popf
  52.         pop    ax
  53.         pop    cx
  54.         pop    di
  55.         pop    es
  56.         pop    ds
  57.         pop    bp
  58.         pop    si
  59.         pop    dx
  60.         ret
  61. sl_strcpyl    endp
  62. ;
  63. ;
  64. stdlib        ends
  65.         end
  66.