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...
-
When a company acts in an ethically questionable manner, what types of problems are caused for the organization and its customers?
-
Acetals can serve as protecting groups for 1,2-diols, as well as for aldehydes and ketones. When the acetal is formed from acetone plus the diol, the acetal is called an acetonide. Show the...
-
3 Specify which trade-oriented sales promotions and public relations tools you will use.
-
Convert the temperatures in parts (a) and (b) and temperature intervals in parts (c) and (d): (a) T = 85F to R, C, K (b) T = 10C to K, F, R (c) T = 85C to K, F, R (d) T = 150R to F, C, K
-
Save Points: 0.09 of 1 Jorge Corp. manufactures hand-wired and solid state lube amplifiers. The following data have been summarized Click the icon to view the data) The company plans to manufacture...
-
Peyton Smith enjoys listening to all types of music and owns countless CDs. Over the years, Peyton has gained a local reputation for knowledge of music from classical to rap and the ability to put...
-
For each of the following events does the dollar rise or fall in value? Use a separate diagram for each of the following scenarios: a. A recession occurs in the United States, lowering U.S. income....
-
1. Gluteus maximus muscle and mention the structures covered by it.
-
2. External features and relations of Kidney.
-
3. Features of Synovial joint and its classification.
-
1. Name the paranasal air sinuses.
-
2. Name the ventricles of Brain.
-
The Pen, Evan, and Torves Partnership has asked you to assist in winding-up its business affairs. You complle the following Information: 1. The partnership's trial balance on June 30,201, Is 2. The...
-
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...
-
30. On January 1,2008, the City of Hastings created a solid waste landfill that it expects to reach capac ity gradually over the next 20 years. If the landfill were to be closed at the current time,...
-
34. On January 1, 2008, a city pays $60,000 for a work of art to display in the local library. The city will take appropriate measures to protect and preserve the piece. However, if the work is ever...
-
32. Mary T. Lincoln works for the City of Columbus. She volunteered to work over the 2008 Christmas break to earn a short vacation during the first week of January 2009. She earns three vacation days...
![Mobile App Logo](https://dsd5zvtm8ll6.cloudfront.net/includes/images/mobile/finalLogo.png)
Study smarter with the SolutionInn App