xref: /original-bsd/lib/libc/hp300/string/strcmp.s (revision c3e32dec)
1/*-
2 * Copyright (c) 1990, 1993
3 *	The Regents of the University of California.  All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * the Systems Programming Group of the University of Utah Computer
7 * Science Department.
8 *
9 * %sccs.include.redist.c%
10 */
11
12#if defined(LIBC_SCCS) && !defined(lint)
13	.asciz "@(#)strcmp.s	8.1 (Berkeley) 06/04/93"
14#endif /* LIBC_SCCS and not lint */
15
16#include "DEFS.h"
17
18/*
19 * NOTE: this guy returns result compatible with the VAX assembly version.
20 * The C version on the portable gen directory returns different results
21 * (different signs!) when comparing chars with the high bit on.  Who is
22 * right??
23 */
24ENTRY(strcmp)
25	movl	sp@(4),a0	/* a0 = string1 */
26	movl	sp@(8),a1	/* a1 = string2 */
27scloop:
28	movb	a0@+,d0		/* get *string1 */
29	cmpb	a1@+,d0		/* compare a byte */
30	jne	scexit		/* not equal, break out */
31	tstb	d0		/* at end of string1? */
32	jne	scloop		/* no, keep going */
33	moveq	#0,d0		/* strings are equal */
34	rts
35scexit:
36	subb	a1@-,d0		/* *string1 - *string2 */
37	extbl	d0
38	rts
39