summaryrefslogtreecommitdiff
path: root/frontends/calculator/CEdev/lib/shared/strnlen.src
blob: f7e7380fe16b1605fbbaef6fcd4afa922aeee5fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
	.def _strnlen
	.ref __frameset0
	.assume adl=1

_strnlen:
	call	__frameset0
	ld	de,(ix+6)
	ld	bc,(ix+9)
	or	a,a
	sbc	hl,hl
	jr	StartFor
ForLoop:
	inc	hl
	inc	de
StartFor:
	push	hl
	or	a,a
	sbc	hl,bc
	pop	hl
	jr	nc,ReachedMax
	ld	a,(de)
	or	a,a
	jr	nz,ForLoop
ReachedMax:
	ld	sp,ix
	pop	ix
	ret