/* This C language subroutine copies one string into another with a length argument. 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
char *strncpy(char *s1, const char *s2, size_t size); */ #include "lib_glob.h" #include "str_glob.h" .SEGMENT/CODE Code_Space_Name; .FILE RTL_FILENAME; .GLOBAL ___strncpyDP; ___strncpyDP: copy_core: R0=PASS R4, dm_ptr=R4; /*Point to output */ pm_to_dm_copy: pm_ptr=R8; /*Point to input */ R12=R12-1, R2=PM(pm_ptr,1); /*Read first sample */ IF EQ JUMP (PC, pm_dm_finish); /*Only one copy */ LCNTR=R12, DO pm_dm UNTIL LCE; /*Loop n times */ R2=PASS R2, DM(dm_ptr,1)=R2; pm_dm: IF NE R2=PM(pm_ptr,1); pm_dm_finish: DM(dm_ptr,1)=R2; /*Write out last */ FETCH_RETURN restore_state: RETURN (DB); RESTORE_STACK RESTORE_FRAME .ENDSEG;