
		public	_bcmp	    ; compare two blocks of memory

		;   BCMP(src, dst, len)
		;   char *src, *dst;
		;   long len;

_bcmp:		move.l	4(sp),A0
		move.l	8(sp),A1
		move.l	12(sp),D0
		move.w	D0,D1	    ;longword align address
		neg.w	D1
		and.w	#3,D1
		cmp.w	D0,D0	    ;force Z bit
		bra	.bc2
.bc1		cmpm.b	(A0)+,(A1)+
.bc2		dbne	D1,.bc1
		bne	.bcfail
		move.l	D0,D1
		lsr.l	#2,D1	    ;# of longwords to compare
		cmp.w	D0,D0	    ;force Z bit
		bra	.bc11
.bc10		cmpm.l	(A0)+,(A1)+
.bc11		dbne	D1,.bc10
		bne	.bcfail
		sub.l	#$10000,D0
		bcc	.bc10
		and.w	#3,D0	    ;remaining bytes to compare
		cmp.w	D0,D0	    ;force Z bit
		bra	.bc21
.bc20		cmpm.b	(A0)+,(A1)+
.bc21		dbne	D0,.bc20
		bne	.bcfail
		moveq.l #1,D0	    ;success!
		rts
.bcfail 	moveq.l #0,D0	    ;failure!
		rts

