/* This C language subroutine provides support for the fixed point types of the language. The Run Time Library for the C Language. Gordon A. Sterling (617) 461 - 3076 DSP Development Tools Engineering Created on 6/10/90 Updated on 5/94 by AS fract ___xdiv(fract N, fract D); fract ___dtox(double x); fract ___ldtox(long double x); */ #include "lib_glob.h" #include "fxd_glob.h" .SEGMENT/CODE Code_Space_Name; .FILE RTL_FILENAME; .GLOBAL ___xdiv; .GLOBAL ___dtox, ___ldtox; ___xdiv: put(R7); put(R11); R2=MODE1; /*Save old mode*/ BIT CLR MODE1 16384; /*Set extended mode*/ F11=2.0; R0=-31; /*Used to convert fix to float*/ CALL (PC, ___float_divide) (DB); F7=FLOAT R4 BY R0; /*Convert to long float*/ F12=FLOAT R8 BY R0, FETCH_RETURN R11=31; /*Used to convert float to fix*/ R0=FIX F7 BY R11, MODE1=R2; /*Restore mode, convert to fixed*/ restore_state: get(R11,1); get(R7,2); RETURN (DB); RESTORE_STACK RESTORE_FRAME ___ldtox: ___dtox: put(R3); reads(R4,1); reads(R8,2); CALL (PC, ___lib_dtox) (DB); R0=PASS R4; R1=PASS R8, FETCH_RETURN get(R3,1); RETURN (DB); RESTORE_STACK RESTORE_FRAME .ENDSEG;