Question: In this assignment you need to write a program in MIPS assembly language. Your program should perform following tasks: It should prompt the user

In this assignment you need to write a program in MIPS assembly  language. Your program should perform following tasks: It should prompt the user 

In this assignment you need to write a program in MIPS assembly language. Your program should perform following tasks: It should prompt the user to enter five numbers one by one. Once user has entered all five numbers, your program should add these numbers and display the result. A skeleton of program is shown. You MUST follow the pattern Call a function get_input This function should use a function printPrompt to provide appropriate prompt to the user and obtain five numbers from the user one by one. Make sure to store all these five numbers on stack. Next your program calls add_Num function. This function accepts five arguments, adds these and returns the result back to main using stack. Finally in the main function your program should display the result using a function display_output. Note the output in the sample run. Your program should produce exactly the same output. A WORD OF CAUTION: .text main: USE STACK TO STORE THE INPUT ARGUMENTS TO DIFFERENT FUNCTIONS. 0 YOUR RETURN VALUE/S AND RETURN ADDRESSES SHOULD ALSO BE STORED ON STACK, EVEN IF YOU THINK IT IS NOT NECESSARY. + DO NOT USE $VO OR $V1 FOR RETURNING VALUES FROM SUBPROCEDURES. 0 YOU CAN ONLY USE $t0 AND $t1 AS TEMPORARY DATA REGISTERS IN YOUR CODE. Given is a base line idea of how to formalize this task. Make sure not to deviate form the base line format. Use program stack intelligently. .data #your data goes here jal get input jal add_num jal display_output jal exit program get_input: #here you should repeatedly call print Prompt function to provide a #prompt followed by instructions to read an integer from user. printPrompt: #this function prints a string on the screen. add_num: #this function receives five arguments from the caller and adds #numbers. It then returns the result to the caller. these #Make sure that you CANNOT use any data register other than $t0 and $t1. display_output: #this function displays the output as per format described in the sample #run shown below. exit_program: #this function terminates the program gracefully. A sample run of the program is shown: Enter first number: 2 Enter second number: 3 Enter third number: 4 Enter fourth number: 5 Enter fifth number: 6 2 + 3+ 4+ 5+ 6 = 20

Step by Step Solution

3.52 Rating (155 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

data prompt1 asciiz Enter first number prompt2 asciiz Enter second number prompt3 asciiz Enter third ... View full answer

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 General Management Questions!