/* 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 ___strncpyPP; ___strncpyPP: copy_core: R0=PASS R4, R4=R12; R2=PASS R8, R12=pma_i; pm_to_pm_copy: pm_ptr=R2; /*Point to input*/ pma_i=R0; /*Point to output*/ R4=R4-1, R2=PM(pm_ptr,1); /*Read first sample*/ IF LE JUMP (PC, pm_pm_finish); /*Only one copy*/ LCNTR=R4, DO pm_pm UNTIL LCE; /*Loop n times*/ R2=PASS R2, PM(pma_i,1)=R2; pm_pm: IF NE R2=PM(pm_ptr,1); pm_pm_finish: PM(pma_i,1)=R2; FETCH_RETURN restore_state: pma_i=R12; RETURN (DB); RESTORE_STACK RESTORE_FRAME .ENDSEG;