Answered step by step
Verified Expert Solution
Link Copied!

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 3 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
1083
989
Williamson
766
722
Scrub
501
617
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 court)(points 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 (e.g. based on the strcmp function). For example:
Hurley 94
Williamson 44
Scrube -116
You may assume that player names will be fewer than 63 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, 10 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 on-the-fly as you receive player names.
Note: You must follow calling conventions in this program.
Save registers appropriately: Caller- and callee-saved 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 top/bottom of that function.
o Any $t registers whose values must survive a function call should be saved before/after that call
o $ra should be saved/restored in any function that calls another as if it were an $s register.
2. Keep functions independent: There should be no data sharing via registers between functions
other than $a for arguments and $v for return values.
3. Stack discipline: Each function, if it modifies $sp, should restore it before returning.
4. Contiguous, well-organized functions: Functions should be contiguous with a single entry-point
and clear return point(s).
5. The main function isnt special: The calling conventions must be followed in every function,
including main!
6. No exit syscall

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Administration The Complete Guide To Dba Practices And Procedures

Authors: Craig S. Mullins

2nd Edition

0321822943, 978-0321822949

More Books

Students also viewed these Databases questions

Question

3. The group answers the questions.

Answered: 1 week ago

Question

Why do HCMSs exist? Do they change over time?

Answered: 1 week ago