/* This C language subroutine counts the number of zero crossing in an array. The Run Time Library for the C Language. Gordon A. Sterling (617) 461 - 3076 DSP Development Tools Engineering Created on 6/24/90 Updated on 5/94 by AS Updated on 3/95 by AS - separated polymorphic functions #include
int izero_cross(fract in[], int length); int xzero_cross(fract in[], int length); int zero_cross(float in[], int length); */ #include "lib_glob.h" #include "sts_glob.h" .SEGMENT/CODE Code_Space_Name; .FILE RTL_FILENAME; .GLOBAL _izero_cross, _zero_cross; .GLOBAL ___izero_crossD, ___zero_crossD; _zero_cross: _xzero_cross: _izero_cross: ___izero_crossD: ___xzero_crossD: ___zero_crossD: R0=R0-R0, dm_ptr=R4; /* Clear count, set ptr */ R8=R8-1, R12=DM(dm_ptr,dm_1); /* Fetch first point */ R8=R8-1, R4=DM(dm_ptr,dm_1); /* Fetch second point */ IF LE JUMP (PC, finishedd); /* Small array */ /* rm'ed rev 0 silicon fix 'nop'*/ LCNTR=R8, DO count_xzcsd UNTIL LCE; R2=R4 XOR R12, R4=DM(dm_ptr,dm_1); count_xzcsd: IF LT R0=R0+1, R12=R4; finishedd: R2=R4 XOR R12, FETCH_RETURN IF LT R0=R0+1; restore_state: RETURN (DB); RESTORE_STACK RESTORE_FRAME .ENDSEG;