C– – Compiler

the MSP50C6xx length of the string. It is included in the cmm_macr.h file, and is called STR_LENGTH(lstr). For example, STR_LENGTH(8) is 8–2 = 6.

Also note that the user has to supply the length of the input string and the length of the output string in the string multiply operations: the result of multiplying a string by an integer can be one word longer than the input string. Unpredictable results may occur if parameter lgr is not at least equal to lgr+1.

5.5.10 Constant Functions

The only two constant functions implemented in C– – are xfer_const and xfer_single.

cmm_func xfer_const(int *out,int *constant_in,int lg)

It transfers lg+2 integers from program ROM starting at address constant_in to RAM, starting at address out. Note that constant_in is not doubled, because it is used in A0 in a MOV A0,*A0 operation. The C– – compiler takes care of this.

cmm_func xfer_single(int *out,int *constant_in) transfers a single value.

An example of the use of xfer_const is:

int array[8],i;

const int atan[80*8] ={.........640 integers );

/* .... */

for(i=0;i<80;i++){

xfer_const(array,&atan[i*8],STR_LENGTH(8)); /* ... now use array normally

..... */

}

Code Development Tools

5-23

Page 319
Image 319
Texas Instruments MSP50C6xx manual Constant Functions, An example of the use of xferconst is