/* ELEC 6200 CPU Design Project - Test Program */
/* Function f fills array n using passed arguments*/

int f(g,n)
  int g,*n;			-- passed value g and address n
{
 int i,k;			-- local variables
 for (i=0; i<2; i++)		-- exercize a for loop
  {
   k = g + i;			-- create value for k
   if (i >= 1)			-- test if-then-else
	n[i] = k + 0x102;		-- test add
   else
	n[i] = k - 0x201;		-- test subtract
  }
 while (i < 3)			-- test while loop
  {
   n[i] = k - i;			-- test subtract
   i = i + 1;			-- loop control variable
  }
 return(i);			-- return value to main
}


/* Main Program - initialize a variable & call f */

void main()
{
 int a,b[8];				// define variables
 a = f(0x111,b);				// call f and return b
}


