RosettaCodeData/Task/Copy-a-string/Z80-Assembly/copy-a-string-3.z80

13 lines
361 B
Z80 Assembly

StrCpy:
;input: HL = base address of string you wish to copy
; DE = where you want to copy it to.
; This program assumes that the string is null-terminated, and that there is enough RAM to hold the entire string.
ld a,(hl)
or a ;compare A to 0.
ret z
ld (de),a
inc hl
inc de
jr StrCpy