os-z80/libs/strings.z80

12 lines
150 B
Z80 Assembly

; 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