Add strlen to the standard library
This commit is contained in:
parent
eee79bfcc6
commit
75754cfb7f
11
libs/strings.z80
Normal file
11
libs/strings.z80
Normal 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
|
Loading…
Reference in New Issue
Block a user