home *** CD-ROM | disk | FTP | other *** search
/ C!T ROM 5 / ctrom5b.zip / ctrom5b / PROGRAM / ASM / ALIB30B / STR33.ASM < prev    next >
Assembly Source File  |  1994-10-15  |  2KB  |  60 lines

  1.     page    66,132
  2. ;******************************** STR33.ASM  *********************************
  3.  
  4. LIBSEG           segment byte public "LIB"
  5.         assume cs:LIBSEG , ds:nothing
  6.  
  7. ;----------------------------------------------------------------------------
  8. .xlist
  9.     include  mac.inc
  10.     include  common.inc
  11. .list
  12. ;----------------------------------------------------------------------------
  13.     extrn    strlen1:far
  14. comment 
  15. ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( STRING  )
  16. STR_COPY - copy a string to existing buffer
  17. ;
  18. ; inputs:    DS:[SI] pointing to string
  19. ;            ES:[DI] pointing to destination buffer
  20. ;            
  21. ; output:    CX = string length
  22. ;
  23. ; note:      The string's terminating NUL byte is also copied.
  24. ;* * * * * * * * * * * * * *
  25. 
  26.     PUBLIC    STR_COPY
  27. STR_COPY    PROC    FAR
  28.     CALL    strlen1
  29.     APUSH   CX,SI,DI
  30.     CLD
  31.     REPZ    MOVSB
  32.             movsb                  ;move zero byte
  33.     APOP    DI,SI,CX
  34.     retf
  35. STR_COPY    ENDP
  36. comment 
  37. ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -(  STRING )
  38. STR_COPYC - copy CX bytes to an existing buffer
  39. ;
  40. ; inputs:    DS:[SI] pointing to ASCII string
  41. ;            ES:[DI] pointing to destination buffer
  42. ;            CX = number of bytes to copy
  43. ;
  44. ; output:    nothing
  45. ;
  46. ; note:      The string's terminating NUL byte is NOT copied.
  47. ;* * * * * * * * * * * * * *
  48. 
  49.     PUBLIC    STR_COPYC
  50. STR_COPYC    PROC    FAR
  51.     APUSH   CX,SI,DI
  52.     CLD
  53.     REPZ    MOVSB
  54.     APOP    DI,SI,CX
  55.     RETF
  56. STR_COPYC ENDP
  57.  
  58. LIBSEG    ENDS
  59.     end
  60.