You have implemented a loop structure in the previous assignment. To improve the program
structure, you need to put a part of the code that performs certain sub function into a
procedure (method). In this question, you need to put the part of the MIPS code
corresponding to the following high-level language code into a procedure: [Total 20 points]
if (W[i] > Max)
{
Max = W[i];
Winner = "Player " + Convert.ToString(i);
}
In the procedure, W[i] and Max must be treated a parameters (inputs), and the modified MAX
value and the modified Winner value must treated as the return values (outputs) of the procedure.
The reserved registers for parameter passing and return value must be used for this purpose.
THE CODE:
.data
Array: .word 0:5
PlayerInput: .asciiz "\n Enter the weight of Player " # Define a constant string.
OutputJuan: .asciiz "\n Player " # Define a constant string.
OutputTwo: .asciiz "wins with weight = " #Define a constant string.
NewLine: .asciiz "\n" #Define a constant string.
.text
l
Comments
Leave a comment