Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a MIPS program called plusminus.s . your assembly program will read in lines of input from the console. Each line will be read in
Write a MIPS program called plusminus.s your assembly program will read in lines of input from the
console. Each line will be read in as its own input using spims syscall support for reading in inputs of
different formats The input is a series of player stats, where each team entry is input lines long. The
first line is a name to identify the players last name a string with no spaces the second line is how
many points the players team has scored while that player is on the court an int the third line is how
many points the opposition team has scored while that player is on the court another int After the
last player in the list, the last line of the file is the string DONE For example:
Hurley
Williamson
Scrub
DONE
Your program should prompt the user each expected input. For example, if youre expecting the user to
input a player name, print to console something like Player name:
Your program should output a number of lines equal to the number of players, and each line is the
player name and the metric that is computed as:
points scored by players team while on courtpoints scored by opposition team while on court
The lines should be sorted in descending order based on this metric, and you must write your own
sorting function you cant just use the qsort library function Players with equal metrics should be
sorted alphabetically eg based on the strcmp function For example:
Hurley
Williamson
Scrube
You may assume that player names will be fewer than characters.
Empty files and files of the wrong format will not be fed to your program.
IMPORTANT: There is no constraint on the number of players, so you may not just allocate space for,
say, player records; you must accommodate an arbitrary number of players. You must allocate space
on the heap for this data.
you must dynamically allocate
memory onthefly as you receive player names.
Note: You must follow calling conventions in this program.
Save registers appropriately: Caller and calleesaved registers should be saved as needed at
the appropriate times.
o All $s registers that get modified in a function should be saved at the topbottom of that function.
o Any $t registers whose values must survive a function call should be saved beforeafter that call
o $ra should be savedrestored in any function that calls another as if it were an $s register.
Keep functions independent: There should be no data sharing via registers between functions
other than $a for arguments and $v for return values.
Stack discipline: Each function, if it modifies $sp should restore it before returning.
Contiguous, wellorganized functions: Functions should be contiguous with a single entrypoint
and clear return points
The main function isnt special: The calling conventions must be followed in every function,
including main!
No exit syscall
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started