In this assignment you need to write a program in MIPS assembly language. Your program should...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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 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
Expert Answer:
Answer rating: 100% (QA)
data prompt1 asciiz Enter first number prompt2 asciiz Enter second number prompt3 asciiz Enter third ... View the full answer
Related Book For
Intermediate Accounting
ISBN: 978-0077400163
6th edition
Authors: J. David Spiceland, James Sepe, Mark Nelson
Posted Date:
Students also viewed these general management questions
-
Introductory Accounting does not require complex math or complicated procedures. It is important to assign cost figures to their correct place in the key financial documents. This Homework is a...
-
i need some help regarding capsim. im currently on round three but my products market share is the lowest amongst competitors so far. would anyone be able to take a look at my pictures and give me...
-
Straightforward calculation of overhead variances: manufacturer The data below relate to Sporty Ltd, a manufacturer of exercise equipment, for August: Standard variable overhead rate $27 per machine...
-
Dominic and Jared were general partnership has equal partners Dominic contributes cash 25,000 securities values at 50,000 and they adjusted basis of 32,000 and equipment valued at 25,000 and an...
-
The EPA wants to test a randomly selected sample of n water specimens and estimate the mean daily rate of pollution produced by a mining operation. If the EPA wants a 95% confidence interval estimate...
-
Sketch how the Mach number and velocity vary through a de Laval nozzle from the entrance to the exit. How is the velocity variation different from a venturi configuration?
-
Can the project manager and the systems analyst be the same? Explain your answer.
-
The following is the ending balances of accounts at December 31, 2018 for the Vosburgh Electronics Corporation. Additional Information: 1. The common stock represents 1 million shares of no par stock...
-
Irvine Corporation's fiscal year-end is December 31, 2024. The following is a partial adjusted trial balance as of December 31. Accounts Debit Credit Retained Earnings $13,000 Dividends $1,300...
-
1. A friend has offered to play a gambling game with you that involves flipping a coin that be has provided. Since a flip of heads will be to his advantage, you want to test the coin for fairness...
-
The ceiling for the federal funds rate is set by the: a. repurchase agreements and interest on excess reserves. b. discount rate. c. open market trading desk. d. president of the country.
-
21. Calculate the heat energy required to melt 8 kg of ice (Latent heat of fusion 3.34e5 J/kg). A. 2672000 J B. 3376316.722 J C. 1905304.128 J D. 2186520.004 J E. 1422067.935 J Mui.
-
A 2000 kg car starts with a velocity of 25 m/s Forward, and after 3 seconds the car has a velocity of 10 m/s Forward. A) Find the Av of the car: AV=VF-VI 10-25 B) Find the acceleration of the car: m...
-
You are an engineering student at zmir Katip elebi University and The New Year 2023 is fast approaching. Despite your study load, you decide to see your relatives and attend New Year Dinner at the...
-
The data listed below are claimed for a power cycle operating between hot and cold reservoirs at 500C and 10C, respectively. For each case, determine whether the cycle operates reversibly, operates...
-
Suppose you have just finished the final year of your undergraduate degree at university and are faced with the choice of either getting a job when you graduate or studying for a Masters degree, and...
-
One of your customers is delinquent on his accounts payable balance. You've mutually agreed to a repayment schedule of $500 per month. You will charge 1.65 percent per month interest on the overdue...
-
Nike manufactures shoes and sportswear. How has the Internet changed the way this company communicates with its suppliers and retail customers?
-
Diluted EPS would be precisely the same whether convertible securities were actually converted or not. Why?
-
Indicate (by letter) the way each of the items listed below should be reported in a balance sheet at December 31, 2011.
-
On June 30, 2011, Rosetta Granite purchased a machine for $120,000. The estimated useful life of the machine is eight years and no residual value is anticipated. An important component of the machine...
-
Th e quick ratio for Company A is closest to: A . 0.43. B . 0.57. C . 1.00.
-
Based on Exhibit 1, the fi nancial leverage ratio for Company B is closest to: A . 0.55. B . 1.22. C . 2.22. EXHIBIT 1 Common-Size Balance Sheets for Company A, Company B, and Sector Average Company...
-
Based on Exhibit 1, which ratio indicates lower liquidity risk for Company A compared with Company B? A . Cash ratio. B . Quick ratio. C . Current ratio. EXHIBIT 1 Common-Size Balance Sheets for...
Study smarter with the SolutionInn App