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