strcpy

Purpose: Copy an ASCIIz string from one SRAM memory location to another SRAM location.
Assumes:  szPtrTo and szPtrFrom are valid.
Passed:     R25:R24  CHAR *   szPtrTo the SRAM destination address
R23:R22  CHAR *   szPtrFrom   the SRAM source address
Returns: R25:R24  CHAR *   szPtrTo the caller's szPtrTo value (unmodified)
Alters: R21, the destination memory block, and the FLAGs
Example: 
Insert4Spaces:
   MOVW    R24, R26         ; To make room at the start of a buffered string,
   ADIW    R24, 4           ;  set the destination pointer higher in memory
   MOVW    R22, R26         ; Leave the source pointer where it was originally
   CALL    Astrcpy          ; OK, we're good to go; copy the string
   LDI     R21, ' '
   ST      X+, R21
   ST      X+, R21          ; Replace those first four (4) bytes with spaces
   ST      X+, R21
   ST      X+, R21
   RET
Notes: The strcpy System Function determines which "direction" to copy, so overlapping string ranges are handled correctly (i.e., so characters are not overwritten and lost while copying.)
The szPtrTo and szPtrFrom values are not checked for validity.
An ASCIIz string is a series of printable characters, terminated with a NULL (= 0) BYTE.
Dropin: 
(setup
code)
;   Setup for the strcpy() call:
; Passed:  R25:R24 CHAR * szPtrTo   pointer to the SRAM destination buffer
;          R23:R22 CHAR * szPtrFrom pointer to the SRAM source buffer
; Returns: R25:R24 CHAR * the caller's szPtrTo value (unmodified)
; Alters:  R21, the destination memory block, and the FLAGSs
Also see:  The strlen, memcpy, and memcpyEEPROM System Functions as well as the EIS (in Edit) System Command.