/* This C language subroutine determines the length of a string. The Run Time Library for the C Language. Gordon A. Sterling (617) 461 - 3076 DSP Development Tools Engineering Created on 4/30/90 Updated on 5/94 by AS Updated on 3/95 by AS - separated polymorphic functions #include
int strlen(const char *s1); */ #include "lib_glob.h" #include "str_glob.h" .SEGMENT/CODE Code_Space_Name; .FILE RTL_FILENAME; .GLOBAL _strlen; .GLOBAL ___strlenD; _strlen: ___strlenD: len_core: R2=PASS R4, FETCH_RETURN dm_len: dm_ptr=R2; /*Point to start*/ R0=R0-R0, R2=DM(dm_ptr,1); /*Clear count, read first sample*/ R2=PASS R2; /*Check for \0*/ DO find_dm_end UNTIL EQ; IF NE R0=R0+1, R2=DM(dm_ptr,1); /*Inc counter, read next*/ find_dm_end: R2=PASS R2; /*Check for \0*/ restore_state: RETURN (DB); RESTORE_STACK RESTORE_FRAME .ENDSEG;