1: /* 2: * Copyright (c) 1987 Regents of the University of California. 3: * All rights reserved. The Berkeley software License Agreement 4: * specifies the terms and conditions for redistribution. 5: */ 6: 7: #ifdef LIBC_SCCS 8: <@(#)strlen.s 1.1 (Berkeley) 1/20/87\0> 9: .even 10: #endif LIBC_SCCS 11: 12: /* 13: * Return the length of cp (not counting '\0'). 14: * 15: * strlen(cp) 16: * char *cp; 17: */ 18: #include "DEFS.h" 19: 20: ENTRY(strlen) 21: mov 2(sp),r0 / r0 = cp 22: 1: 23: tstb (r0)+ / find end os string 24: bne 1b 25: sub 2(sp),r0 / length = location('\0')+1 - cp - 1 26: dec r0 27: rts pc