projects
/
fw
/
sdcc
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
* as/z80/z80mch.c: fixed bug #1704376: missing as-z80 errors
[fw/sdcc]
/
device
/
lib
/
z80
/
strlen.s
1
.area _CODE
2
3
.globl _strlen
4
5
; The Z80 has the cpir instruction, which is perfect for implementing strlen().
6
7
_strlen:
8
push ix
9
ld ix, #0
10
add ix, sp
11
ld l, 4(ix)
12
ld h, 5(ix)
13
xor a, a
14
ld b, a
15
ld c, a
16
cpir
17
ld hl, #-1
18
sbc hl, bc ; C flag still cleared from xor above.
19
pop ix
20
ret
21