Question: Chapter 2 MIPS Textbook Exercises Use the appropriate syscall to create MIPS programs for the following exercises. Think of syscall as being the name of
Chapter 2 MIPS Textbook Exercises
Use the appropriate syscall to create MIPS programs for the following exercises. Think of syscall as being the name of a generic Java method that is passed at least one argument (an integer) indicating what function to carry out, and other arguments as required. All arguments are provided using the specified registers or in data areas pointed to by an address in a specified register.
Examples of these types of methods you may have encountered in CIT-111 or CIT-130 include the Scanner classs .nextInt and .next methods to retrieve an integer or word typed at the system console, or System.out.println to print a string on the console.
The textbook has example program code that you can copy/paste, edit/add/delete as the basis for these programs, which should consist of very few instructions. See the accompanying file for one such example as well as a link to a list of syscall functions, codes, and arguments.
Submit your MIPS code as .txt text file (not a Word or PDF file) for each question. There should be 4 files in total.
Use comments as appropriate and ALWAYS use the appropriate syscall program code to terminate the program.
1) Write a MIPS program to print out a random number from 1..100. Hint: Use random int range syscall 42, be mindful on how to get a result that is between 1100 and not 0...99
2) Write a MIPS program which sleeps for 4 seconds before exiting. Hint: Remember to use milliseconds (1 second = 1000 seconds)
3) Write a MIPS program to prompt, read and print a floating point number.
4) Write a MIPS program which prompts the user to enter their favorite type of pie. The program should then print out "So you like _____ pie", where the blank line is replaced by the pie type entered.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
