/* This C language subroutine searches for a character within 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 - seperated polymorphic functions #include
char *strchr(const char *s1, int c); */ #include "lib_glob.h" #include "str_glob.h" .SEGMENT/CODE Code_Space_Name; .FILE RTL_FILENAME; .GLOBAL ___strchrP; ___strchrP: chr_core: R0=PASS R4; R4=PASS R8, pm_ptr=R0; pm_chr: R8=PM(pm_ptr,1); /*Read first sample*/ DO find_pm_chr UNTIL FOREVER; COMP(R4,R8); IF EQ JUMP (PC, pm_detour) (LA); R8=PASS R8; IF EQ JUMP (PC, end_of_array) (LA); find_pm_chr: R0=R0+1, R8=PM(pm_ptr,1); COMP(R4,R8), FETCH_RETURN IF NE R0=R0-R0; restore_state: RETURN (DB); RESTORE_STACK RESTORE_FRAME end_of_array: JUMP (PC, restore_state) (DB); /*End of array reached*/ FETCH_RETURN R0=0; /*Return a NULL */ pm_detour: JUMP (PC, restore_state) (DB); FETCH_RETURN nop; .ENDSEG;