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...
-
Betty is a real estate dealer and has numerous properties for sale, many of which she owns. Her son is finishing his education and plans to go into the consulting business. Betty has committed to...
-
Explain the pay-as-you-go system.
-
The aluminum block has a rectangular cross section and is subjected to an axial compressive force of 8 kip. If the 1.5-in. side changes its length to 1.500132 in., determine Poisson's ratio and the...
-
Ken is 63 years old and unmarried. He retired at age 55 when he sold his business, Understock.com. Though Ken is retired, he is still very active. Ken reported the following financial information...
-
On the first day of the current fiscal year, $2,000,000 of 10-year, 7% bonds, with interest payable semiannually, were sold for $2,125,000. Journalize the following transactions for the current...
-
Susan Jones would like her investment portfolio to be selected from a combination of three stocks Alpha, Beta, and Gamma. Let variables A, B, and G denote the percentages of the portfolio devoted to...
-
ertain of the assumptions and data. Server WebSrv6 hosts a company Web site and performs e-commerce transactions. It has a Web server version that can be attacked by sending it invalid Unicode...
-
Sarah has one shareholder, Parent Co. It distributes the following assets to parent Co and a complete liquidation: Land FMV $150,000, basis 120,000. Inventory FMV $60,000, basis $45,000. Building FMV...
-
Demonstrate how you can effectively and proactively deal with challenges that come along with a diversified human resource in an organization.
-
From the case with title "Resource Planning At Akshaya Patra Vasanthapura" by Anshuman Tripathy and Kiran K, 1. Prepare a process chart of the production process of rice and sambar from procurement...
-
What is the beta of the following portfolio? Amount Stock Invested A SA $ 15,000 Security Beta 1.40 B $ 15,000 1.20
-
Should the targeted employee's response be relevant at all? Should an employer be responsible for monitoring the working environment to a reasonable level, and responding reasonably, if it finds out...
-
A 4.00 W LED light bulb is turned on. It has an operating voltage of 120 V. How much current flows through the bulb?
-
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...
-
Testing \(H_{0}: p_{1}=p_{2}\) vs \(H_{a}: p_{1}>p_{2}\) using \(\hat{p}_{1}-\hat{p}_{2}=0.8-0.7=0.10\) with each of the following sample sizes: (a) \(\hat{p}_{1}=24 / 30=0.8\) and \(\hat{p}_{2}=14 /...
-
100 tests conducted using a significance level of \(5 \%\). We are conducting many hypothesis tests to test a claim. In every case, assume that the null hypothesis is true. Approximately how many of...
-
Testing \(H_{0}: p=0.5\) vs \(H_{a}: p>0.5\) using \(\hat{p}=0.55\) with each of the following sample sizes: (a) \(\hat{p}=55 / 100=0.55\) (b) \(\hat{p}=275 / 500=0.55\) (c) \(\hat{p}=550 /...
Study smarter with the SolutionInn App