Motorola once sc140 User Manual

Page of 40
Compiler Support on StarCore
Introduction to the SC140 Tools
27
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]);