141814Sbostic/*- 2*61123Sbostic * Copyright (c) 1990, 1993 3*61123Sbostic * The Regents of the University of California. All rights reserved. 441814Sbostic * 541814Sbostic * This code is derived from software contributed to Berkeley by 641814Sbostic * the Systems Programming Group of the University of Utah Computer 741814Sbostic * Science Department. 841814Sbostic * 941814Sbostic * %sccs.include.redist.c% 1041814Sbostic */ 1141814Sbostic 1241814Sbostic#if defined(LIBC_SCCS) && !defined(lint) 13*61123Sbostic .asciz "@(#)strcmp.s 8.1 (Berkeley) 06/04/93" 1441814Sbostic#endif /* LIBC_SCCS and not lint */ 1541814Sbostic 1641814Sbostic#include "DEFS.h" 1741814Sbostic 1841814Sbostic/* 1941814Sbostic * NOTE: this guy returns result compatible with the VAX assembly version. 2041814Sbostic * The C version on the portable gen directory returns different results 2141814Sbostic * (different signs!) when comparing chars with the high bit on. Who is 2241814Sbostic * right?? 2341814Sbostic */ 2441814SbosticENTRY(strcmp) 2541814Sbostic movl sp@(4),a0 /* a0 = string1 */ 2641814Sbostic movl sp@(8),a1 /* a1 = string2 */ 2741814Sbosticscloop: 2841814Sbostic movb a0@+,d0 /* get *string1 */ 2941814Sbostic cmpb a1@+,d0 /* compare a byte */ 3041814Sbostic jne scexit /* not equal, break out */ 3141814Sbostic tstb d0 /* at end of string1? */ 3241814Sbostic jne scloop /* no, keep going */ 3341814Sbostic moveq #0,d0 /* strings are equal */ 3441814Sbostic rts 3541814Sbosticscexit: 3641814Sbostic subb a1@-,d0 /* *string1 - *string2 */ 3741814Sbostic extbl d0 3841814Sbostic rts 39