Question: MIPS ASSEMBLY Language Converting C++ to assembly language readData : This function is to read the input and store it into the array. Notice that
MIPS ASSEMBLY Language
Converting C++ to assembly language
readData : This function is to read the input and store it into the array. Notice that there is one parameter (use $a0 for this) and one return value (use $v0 for this). You may access the array using subscripts or pointers through the parameters but you must not access the global data directly. Also, you must use $s registers for the variables count and i (below). As these are saved registers, you must save these registers on the stack at the beginning of the function and restore them at the end. This function does not call another function. You do not have to error check on the value of count.
int readData (int list []){
int count;
cout << "How many values to read? ";
cin >> count;
for (int i = 0; i < count; i++){
cin >> list[i]; //read into list[i]
}
return count;
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
