1/*- 2 * Copyright (c) 1991 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Computer Consoles Inc. 7 * 8 * %sccs.include.proprietary.c% 9 */ 10 11#ifndef lint 12 .asciz "@(#)i_indx_s.s 5.2 (Berkeley) 04/12/91" 13#endif /* not lint */ 14 15.data 16.text 17LL0:.align 1 18.globl _i_indx 19.set MASK__, 0x1c0c 20.data 21.text 22_i_indx: .word MASK__ 23 24 movl 4(fp), r3 /* s = a */ 25 movl 8(fp), r10 /* b */ 26 movl 16(fp), r12 /* lb */ 27 addl3 r3, 12(fp), r11 /* end = a + la */ 28 subl2 r12, r11 /* end -= lb */ 29loop: 30 cmpl r3, r11 /* while (s <= end) */ 31 jgtr out0 /* not found - return(0) */ 32 movl r3, r0 /* current s in string */ 33 movl r10, r1 /* b */ 34 movl r12, r2 /* lb */ 35 cmps3 /* if strings equal */ 36 jeql out /* return index */ 37 38 incl r3 /* s++ */ 39 jbr loop 40 41out: 42 incl r3 /* index = ++s - a */ 43 subl3 4(fp), r3, r0 44 ret 45 46out0: 47 clrl r0 48 ret 49