Add strlen to the standard library

This commit is contained in:
pjht 2023-11-05 10:33:57 -06:00
parent eee79bfcc6
commit 75754cfb7f
Signed by: pjht
GPG Key ID: 7B5F6AFBEC7EE78E

11
libs/strings.z80 Normal file
View File

@ -0,0 +1,11 @@
; 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