Question: Write a MIPS assembly language program that takes user input ( S ) huffle , ( D ) raw , and ( Q ) uit

Write a MIPS assembly language program that takes user input (S)huffle,(D)raw, and (Q)uit. You
can use just the letter or the whole word.
On Shuffle, the deck is copied from the Cards array and the discard array is cleared. Current draw
index will be set to 51 by the main program. Shuffle is available any time.
Draw can only be selected if the deck is not empty (the program should start with an empty deck
and current draw index set to 0). Draw removes a value from the bottom of the deck array, adds it
to the discard array, and returns the value to the main program so the main program can print the
card. The main program should decrement the index on each draw until it is 0, after which only
Shuffle or Quit may be selected.
On Quit, the program ends and Quit may be selected at any time.
Here are some tips and requirements:
Use the MIPS syscalls to print out prompts and read in characters. There is an example
program that demonstrates the various syscalls in the Supplemental Material section in
Canvas. Do NOT use syscalls higher than 10, with the exception of 30 in this project.
Do NOT use a routine you found online to generate random numbers or use the system
service to get a random number. You must implement the Linear Congruence algorithm
yourself, modified from Project 1.
Start by calling the shuffle routine from main, having it only copy the Cards array and
modifying my print loop to print your copy.
Once that works, try shuffling the array. If that works, the print loop should show the
shuffled deck.
Next clear the discard deck. You can test that code by copying the shuffled deck to the
discard deck, clearing it, and then checking that all the values in the discard deck are 0.
With your shuffle routine working, add the I/O loop. When draw is called for, simply call
the draw routine, which should just have a couple of lines of code to print a messages like
Drawing a card.... Quit should now work.
Now you can implement the draw subroutine. Make sure the selected value (by index from
main) is removed from the deck. Then make sure it gets written to the discard array.
Finally, be sure it is returned by the subroutine and main updates the index and prints out the
string pointed to by the returned value.
Build and test your program in incremental stages to avoid being overwhelmed by details.
For example, you might start off writing a loop that prints out the number "5"20 times. You
might then change it to hard-code a first and last number and then print out every number in
between... and so on.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!