153bd8672Sbostic/*- 2*1f5533beSbostic * Copyright (c) 1990, 1993 3*1f5533beSbostic * The Regents of the University of California. All rights reserved. 453bd8672Sbostic * 553bd8672Sbostic * This code is derived from software contributed to Berkeley by 653bd8672Sbostic * the Systems Programming Group of the University of Utah Computer 753bd8672Sbostic * Science Department. 853bd8672Sbostic * 953bd8672Sbostic * %sccs.include.redist.c% 1053bd8672Sbostic */ 1153bd8672Sbostic 1253bd8672Sbostic#if defined(LIBC_SCCS) && !defined(lint) 13*1f5533beSbostic .asciz "@(#)strcmp.s 8.1 (Berkeley) 06/04/93" 1453bd8672Sbostic#endif /* LIBC_SCCS and not lint */ 1553bd8672Sbostic 1653bd8672Sbostic#include "DEFS.h" 1753bd8672Sbostic 1853bd8672Sbostic/* 1953bd8672Sbostic * NOTE: this guy returns result compatible with the VAX assembly version. 2053bd8672Sbostic * The C version on the portable gen directory returns different results 2153bd8672Sbostic * (different signs!) when comparing chars with the high bit on. Who is 2253bd8672Sbostic * right?? 2353bd8672Sbostic */ 2453bd8672SbosticENTRY(strcmp) 2553bd8672Sbostic movl sp@(4),a0 /* a0 = string1 */ 2653bd8672Sbostic movl sp@(8),a1 /* a1 = string2 */ 2753bd8672Sbosticscloop: 2853bd8672Sbostic movb a0@+,d0 /* get *string1 */ 2953bd8672Sbostic cmpb a1@+,d0 /* compare a byte */ 3053bd8672Sbostic jne scexit /* not equal, break out */ 3153bd8672Sbostic tstb d0 /* at end of string1? */ 3253bd8672Sbostic jne scloop /* no, keep going */ 3353bd8672Sbostic moveq #0,d0 /* strings are equal */ 3453bd8672Sbostic rts 3553bd8672Sbosticscexit: 3653bd8672Sbostic subb a1@-,d0 /* *string1 - *string2 */ 3753bd8672Sbostic extbl d0 3853bd8672Sbostic rts 39