;******************************************************************************
; Filename: STRCPY.ASM
; Author: Peter Andersson
; Version: 0.0
; Created: 1994.11.12
; Updated: -
;******************************************************************************
; Copyright Peter Andersson, 1994.
; All rights reserved.
;******************************************************************************
; Function: PSZ @strcpy(PSZ dest,PSZ source);
; Input: Eax, dest - pointer to destination string
; Edx, source - pointer to source string
; Output: pointer to the destination string
; Comment: Copies a string from <source> to <dest> and returns a pointer to the destination string
;******************************************************************************
Include STDDEF.INC
Codeseg
Proc strcpy ,2
Push Eax
Jmp @@Next01
Align 4
@@Loop01: Add Eax,4
@@Next01: Mov Ecx,[Edx]
Add Edx,4
TestZ Cl
Jz @@Exit01
TestZ Ch
Jz @@Exit02
Test Ecx,0FF0000h
Jz @@Exit03
Test Ecx,0FF000000h
Mov [Eax],Ecx
Jnz @@Loop01
Pop Eax
Ret
Align 4
@@Exit03: Mov [Eax],Cx
Mov [Byte Eax+2],0
Pop Eax
Ret
Align 4
@@Exit02: Mov [Eax],Cx
Pop Eax
Ret
Align 4
@@Exit01: Mov [Eax],Cl
Pop Eax
Ret
Endp
End