xref: /csrg-svn/lib/libc/hp300/string/index.s (revision 61123)
141812Sbostic/*-
2*61123Sbostic * Copyright (c) 1990, 1993
3*61123Sbostic *	The Regents of the University of California.  All rights reserved.
441812Sbostic *
541812Sbostic * This code is derived from software contributed to Berkeley by
641812Sbostic * the Systems Programming Group of the University of Utah Computer
741812Sbostic * Science Department.
841812Sbostic *
941812Sbostic * %sccs.include.redist.c%
1041812Sbostic */
1141812Sbostic
1241812Sbostic#if defined(LIBC_SCCS) && !defined(lint)
13*61123Sbostic	.asciz "@(#)index.s	8.1 (Berkeley) 06/04/93"
1441812Sbostic#endif /* LIBC_SCCS and not lint */
1541812Sbostic
1641812Sbostic#include "DEFS.h"
1741812Sbostic
1841812SbosticENTRY(index)
1941812Sbostic	movl	sp@(4),a0	/* string */
2041812Sbostic	movb	sp@(11),d0	/* char to look for */
2141812Sbosticixloop:
2241812Sbostic	cmpb	a0@,d0		/* found our char? */
2341812Sbostic	jeq	ixfound		/* yes, break out */
2441812Sbostic	tstb	a0@+		/* null? */
2541812Sbostic	jne	ixloop		/* no, keep going */
2641812Sbostic	moveq	#0,d0		/* not found, return null */
2741812Sbostic	rts
2841812Sbosticixfound:
2941812Sbostic	movl	a0,d0		/* found, return pointer */
3041812Sbostic	rts
31