Write an ANNA assembly program (div.ac) to divide two positive (non-zero) numbers and print the quotient,...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write an ANNA assembly program (div.ac) to divide two positive (non-zero) numbers and print the quotient, remainder. Your program should take the numbers for division from user input. NOTES: You can assume that both the numbers are positive and non-zero. The first number entered should be the numerator and the second number should be the denominator in the division. E.g., if the user enters 20 and 10 as inputs (in that sequence), then the program should print 2, 0 (the quotient, and the remainder). E.g. 2, if the user enters 10 and 20 as inputs (in that sequence), then the program should print 0, 10 (the quotient, and the remainder). Note that your program should print the quotient first followed by the remainder. 2. XOR (30 points) In this question you will write an ANNA program to compute the XOR of two numbers. The output of XOR is one if and only if both the inputs are different, otherwise it is zero. The truth table for XOR is given below. Write an ANNA assembly program (xor.ac) that asks the user for two numbers greater than zero and returns the bitwise exclusive-OR (XOR) of the numbers. For instance, if the user types in 64 (0000000001000000) and 100 (0000000001100100), the program should print 36 (0000000000100100), the bitwise XOR of the two numbers. Print -1 if the user entered a zero or less. Hint: Consider using AND, OR, and NOT instructions for implementing the XOR operation. A 0 0 1 1 B 0 1 0 1 A XOR B 0 1 1 0 3. The five smallest numbers (40 points) Write an ANNA assembly program (smallest_five.ac) that finds the five smallest numbers entered by the user. Initially, the program continually asks the user to enter numbers. As soon as a negative value is entered, compute which numbers are the top five (smallest) numbers. For instance, if the user entered 2, 6, 7, 6, 5, 7, 6, 17, 15 -1; the program should print 2, 5, 6, 6, 7 (the five smallest numbers in the sequence). If the user enters a negative number at the beginning, print 0. If the user enters five or fewer numbers, print all the numbers as output. Notes: The goal of this problem is to exercise storing, retrieving, and scanning the numbers stored in memory. Therefore, a solution where you keep track of the smallest five numbers in registers as the numbers are entered is not acceptable. Such a solution will receive a maximum of 15 points for this problem. Do not keep track of everything in the input loop. You will need to store all numbers entered by the user in memory. Store all numbers entered into a growing array. Note that the array should be the last item in your data section so it can grow as large as necessary. And your data section should be at the end of the code section. You may assume there is enough memory to hold all numbers entered by the user. Write an ANNA assembly program (div.ac) to divide two positive (non-zero) numbers and print the quotient, remainder. Your program should take the numbers for division from user input. NOTES: You can assume that both the numbers are positive and non-zero. The first number entered should be the numerator and the second number should be the denominator in the division. E.g., if the user enters 20 and 10 as inputs (in that sequence), then the program should print 2, 0 (the quotient, and the remainder). E.g. 2, if the user enters 10 and 20 as inputs (in that sequence), then the program should print 0, 10 (the quotient, and the remainder). Note that your program should print the quotient first followed by the remainder. 2. XOR (30 points) In this question you will write an ANNA program to compute the XOR of two numbers. The output of XOR is one if and only if both the inputs are different, otherwise it is zero. The truth table for XOR is given below. Write an ANNA assembly program (xor.ac) that asks the user for two numbers greater than zero and returns the bitwise exclusive-OR (XOR) of the numbers. For instance, if the user types in 64 (0000000001000000) and 100 (0000000001100100), the program should print 36 (0000000000100100), the bitwise XOR of the two numbers. Print -1 if the user entered a zero or less. Hint: Consider using AND, OR, and NOT instructions for implementing the XOR operation. A 0 0 1 1 B 0 1 0 1 A XOR B 0 1 1 0 3. The five smallest numbers (40 points) Write an ANNA assembly program (smallest_five.ac) that finds the five smallest numbers entered by the user. Initially, the program continually asks the user to enter numbers. As soon as a negative value is entered, compute which numbers are the top five (smallest) numbers. For instance, if the user entered 2, 6, 7, 6, 5, 7, 6, 17, 15 -1; the program should print 2, 5, 6, 6, 7 (the five smallest numbers in the sequence). If the user enters a negative number at the beginning, print 0. If the user enters five or fewer numbers, print all the numbers as output. Notes: The goal of this problem is to exercise storing, retrieving, and scanning the numbers stored in memory. Therefore, a solution where you keep track of the smallest five numbers in registers as the numbers are entered is not acceptable. Such a solution will receive a maximum of 15 points for this problem. Do not keep track of everything in the input loop. You will need to store all numbers entered by the user in memory. Store all numbers entered into a growing array. Note that the array should be the last item in your data section so it can grow as large as necessary. And your data section should be at the end of the code section. You may assume there is enough memory to hold all numbers entered by the user.
Expert Answer:
Answer rating: 100% (QA)
Here are the ANNA assembly programs for each of the three tasks Division divac section data numerator space 4 denominator space 4 quotient space 4 remainder space 4 section text global start start Dis... View the full answer
Related Book For
Systems analysis and design
ISBN: 978-0136089162
8th Edition
Authors: kenneth e. kendall, julie e. kendall
Posted Date:
Students also viewed these programming questions
-
You have been asked to prepare a December cash budget for Ashton Company, a distributor of exercise equipment. The following information is available about the company s operations: The cash balance...
-
7. In reference to selection of activities (sequencing and progression) and overall safety guidelines, what would you recommend? 8. What are the differences between constructive and actual notice? 9....
-
What are the SDGs ? What is their history? How do they support global sustainability agenda?
-
The condensed balance sheet and income statement data for Cardinal Corporation are presented below. Additional information: 1. The market price of Cardinal common stock was $5.00, $3.50, and $2.30...
-
Tim was recently called into the partner's office and offered a two-year assignment in his public accounting firm's Shanghai office. Realizing that Tim will face incremental expenses while in...
-
If 3.50 m3 of a gas initially at STP is placed under a pressure of 3.20 atm, the temperature of the gas rises to 38.0C. What is the volume?
-
Data sources and destinations are represented in a data flow diagram as: a. a square d. two parallel lines b. a curved arrow e. none of the above c. a circle
-
Where2 Services is a small service firm that advises high school students on college opportunities. Joseph Kapp, the founder and president, has collected the following information for March:...
-
Chartered Professional Accountant(CPA) is one of the most versatile professions amongst the professional accounting field. Anyone who is an adult with an income is required to file a report for their...
-
Mr. Juan Dela Cruz is a self-employed professional based in the Philippines. He provides consulting services in the field of information technology. As a resident Filipino citizen, Mr. Dela Cruz is...
-
Devise a null and alternative hypothesis, then perform a one sample z-test using alpha=0.05 if our class is taller or shorter than the average human in the United States. Graphically display your...
-
Explain the topics and give points Customer Service Description (Approx. half a page Best Customer Experience Description (Approx. half a page) Safety: Chef's Table Standards & Best Practices short...
-
As the stakeholders provide their needs and expectations to improve the process, identify steps that could be improved with the support of a hiring system. Also look for examples of issues and...
-
The cup on the 9th hole of a golf course is located dead center in the middle of a circular green that is 70 feet in diameter. Your ball is located as in the picture below: green 50 feet ball 40 feet...
-
From: Dara Khosrowshahi Date: Fri, Sep 22, 2017 at 12:53 PM Subject: Re: Update on London's License Thanks Pierre, and thanks to everyone working on this issue. Like all of you, I'm hugely...
-
Give the Haskell polymorphic types of the following functions. (a) (5) > const :: > const x _ = x (b) (5) > or :: > or = foldr (||) False (c) (5) > any :: > any p = or . (map p) (d) (5) > ms :: > ms...
-
What is the difference between reactive and proactive monitoring? What are two of the Oracle database tools that can be used for monitoring?
-
How can you tell from the vertex form y = a(x - h) 2 + k whether a quadratic function has no real zeros?
-
SoftWear Silhouettes is a rapidly growing mail-order house specializing in all-cotton clothing. Management would like to expand sales to the Web with the creation of an ecommerce site. The company...
-
Give two instances that indicate that display output is the best solution for the choice of output technology.
-
How should Potts design screen output so that Fields and his group can get what they want on each screen while observing the guidelines for good display design? Remember that the group members are...
-
The annual reports of publicly traded companies describe some of the financial ratios presented in this chapter. Other ratios must be calculated using the information provided in the financial...
-
Using the cash accounting basis, when are revenues and expenses recognized?
-
Although depreciation expense is recognized on the income statement under the accrual basis of accounting, it does not involve an outflow of cash. Why?
Study smarter with the SolutionInn App