	.title	NCOMP
	.psect		code,pic,shr,nowrt,long
;
;	i =  ncomp(a1,ist,isp,a2,ist2)
;
;	routine to compare two strings
;
;	a1   - string one
;	ist  - start pos in a1
;	isp  - end pos in a1
;	a2   - string two
;	ist2 - start pos in a2
;
;	i = -1 - a1 < a2
;	     0 - a1 = a2
;	     1 - a1 > a2
;
	.entry		NCOMP,^m<R2>
	movl		4(AP),R1	;get a1 address
	movl		16(AP),R2	;get a2 address
	movl		@8(AP),R3	;get ist
	addl3		R3,R1,R1	;create start
	decl		R1		;of search string1
	subl3		@8(AP),@12(AP),R3;create length
	incl		R3		;of search
	movl		@20(AP),R4	;get ist2
	addl3		R4,R2,R2	;create start
	decl		R2		;of search string2
;
S1:	cmpb		(R1)+,(R2)+	;compare one byte
	bneq		NOPE
	sobgtr		R3,S1		;a match, try again
	clrl		R0		;indicate a match
	ret
;
NOPE:	bgtr		GTR
	movl		#-1.,R0		;indicate a1 < a2
	ret
GTR:	movl		#1,R0		;indicate a1 > a2
	ret
;
	.end


