CS 2734
Computer Organization II
Before the laboratory:
int b[] = {10, -1, 7, 4, 3, 5, 2, 1};
int d[8];
int computeArray(int a[], int **x, int n)
{
int c[8];
int i;
for (i = 0; i < n; i++) {
c[i] = a[i] - i + b[i];
d[i] = 3*c[i]
a[i] = c[i] + 10;
}
*x = d;
return 0;
}
Assume that the address a is in register $a0, that x is in $a1 and that n is in $a2. Here x is the address of a variable that is a pointer to int. Allocate c on the stack, b as a static initialized variable and d as a static uninitialized variable.
read_array
and write_array functions from Laboratory 4 for
the input and output in the main program.
For checkoff:
This C program produces sample output for you to check your results against.