/*		Q/C V3.2 Utility Library		*/
/*     Copyright (c) 1984 Quality Computer Systems	*/
/*			11/25/84			*/

#include "stdio.h"

#ifdef PORTABLE
/* find the length of a string */
strlen(s)
char *s;
	{
	register len;

	len = 0;
	while (*s++)
		++len;
	return len;
	}
#else
strlen() {
#	asm 8080
	LXI	H,2
	DAD	SP
	MOV	E,M	;get s in DE
	INX	H
	MOV	D,M
	LXI	H,0	;init length counter
?slen1: LDAX	D	;get next character
	ORA	A	;end of string?
	JZ	?slen2
	INX	D
	INX	H	;count one more
	JMP	?slen1
?slen2: MOV	A,H	;length in HL
	ORA	L	;set Z flag
#	endasm
	}
#endif

