/
/ Compare two character strings.
/

	.globl	strcmp

/
/ strcmp(a, b)
/ char *a, *b;
/ Returns -1 if a<b; 0 if a=b; 1 if a>b.
/

strcmp:	mov	2(sp),r0	/Pick up `a'
	mov	4(sp),r1	/And `b'

0:	cmpb	(r0)+,(r1)	/Are they the same
	bne	0f		/No
	tstb	(r1)+		/At the end of the string
	bne	0b		/No
	clr	r0		/Equal return
	return

0:	blo	0f		/Br if a<b
	mov	$1,r0		/A>b return
	return

0:	mov	$-1,r0		/A<b return
	return			/
