Motorola SC140 user manual Solutions to Exercises, Compiler Support on StarCore

Models: SC140

1 40
Download 40 pages 24.33 Kb
Page 27
Image 27
10 Solutions to Exercises

Compiler Support on StarCore

10 Solutions to Exercises

Exercise 1: /*****************************************************************************

*

MOTOROLA INC.

*

SEMICONDUCTOR PRODUCTS SECTOR

*

COPYRIGHT 1999 MOTOROLA INC.

*******************************************************************************

*

INTRODUCTION TO THE SC140 TOOLS

*

Developed by MOTOROLA SPS/NCSG/WISD

*******************************************************************************/

#include <stdio.h>

main()

{

printf(“Welcome to StarCore SC140 Tools\n”);

}

Exercise 2: /*****************************************************************************

*

MOTOROLA INC.

*

SEMICONDUCTOR PRODUCTS SECTOR

*

COPYRIGHT 1999 MOTOROLA INC.

*******************************************************************************

*

INTRODUCTION TO THE SC140 TOOLS

*

Developed by MOTOROLA SPS/NCSG/WISD

*******************************************************************************/

#include <stdio.h> #include <prototype.h>

short x[12] = {0,1,2,3,4,5,6,7,8,9,10,11};

main()

{

short i; long res=0; long fres=0;

for(i=0;i<12;i++)

{

res += x[i] * x[i];

}

for(i=0;i<12;i++)

{

fres = L_mac(fres,x[i],x[i]);

Introduction to the SC140 Tools

27

Page 27
Image 27
Motorola SC140 user manual Solutions to Exercises, Compiler Support on StarCore