home *** CD-ROM | disk | FTP | other *** search
/ Groovy Bytes: Behind the Moon / groovybytes.iso / GROOVY / SND_TOOL / FUNK108A.ZIP / DOS32V30.ZIP / PAL / STRINGS / STRCPY.ASM < prev    next >
Encoding:
Assembly Source File  |  1995-05-20  |  1.3 KB  |  56 lines

  1. ;******************************************************************************
  2. ; Filename: STRCPY.ASM
  3. ;   Author: Peter Andersson
  4. ;  Version: 0.0
  5. ;  Created: 1994.11.12
  6. ;  Updated: -
  7. ;******************************************************************************
  8. ; Copyright Peter Andersson, 1994.
  9. ; All rights reserved.
  10. ;******************************************************************************
  11. ; Function: PSZ @strcpy(PSZ dest,PSZ source);
  12. ;    Input: Eax, dest - pointer to destination string
  13. ;           Edx, source - pointer to source string
  14. ;   Output: pointer to the destination string
  15. ;  Comment: Copies a string from <source> to <dest> and returns a pointer to the destination string
  16. ;******************************************************************************
  17.  
  18.     Include    STDDEF.INC
  19.  
  20.     Codeseg
  21.  
  22. Proc    strcpy  ,2
  23.         Push    Eax
  24.         Jmp    @@Next01
  25.     Align    4
  26. @@Loop01:    Add    Eax,4
  27. @@Next01:    Mov    Ecx,[Edx]
  28.         Add    Edx,4
  29.         TestZ    Cl
  30.         Jz    @@Exit01
  31.         TestZ    Ch
  32.         Jz    @@Exit02
  33.         Test    Ecx,0FF0000h
  34.         Jz    @@Exit03
  35.         Test    Ecx,0FF000000h
  36.         Mov    [Eax],Ecx
  37.         Jnz    @@Loop01
  38.         Pop    Eax
  39.         Ret
  40.     Align    4
  41. @@Exit03:    Mov    [Eax],Cx
  42.         Mov    [Byte Eax+2],0
  43.         Pop    Eax
  44.         Ret
  45.     Align    4
  46. @@Exit02:    Mov    [Eax],Cx
  47.         Pop    Eax
  48.         Ret
  49.     Align    4
  50. @@Exit01:    Mov    [Eax],Cl
  51.         Pop    Eax
  52.         Ret
  53. Endp
  54.  
  55.     End
  56.