os-z80/libs/libstd/strings.z80

22 lines
249 B
Z80 Assembly
Raw Normal View History

2023-11-05 10:33:57 -06:00
; Get the length of the string pointed to by HL in BC
.global strlen
strlen:
ld bc, 0
strlen_loop:
ld a, (hl)
cp 0
ret z
inc bc
inc hl
jp strlen_loop
; Copies the string in HL to DE
.global strcpy
strcpy:
push hl
call strlen
inc bc
pop hl
ldir
ret