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...
-
Evaluate at least three benefits that sustainability-led innovation offers to the environment, the company's operations systems change, and to the various stakeholders . Analyze at least two...
-
Refer to the annual report of Colgate in Appendix A at the back of this book. Required: a. Compute all of the expense categories as a percentage of sales for each of the three years shown. Analyze...
-
What are some types of system characteristics?
-
City Bank has several departments that occupy both floors of a two-story building. The depart mental accounting system has a single account, Building Occupancy Cost, in its ledger. The types and...
-
Needs Analysis : The analysis of the information gathered on the community military veterans and mental health. This will provide a conclusions you have drawn from thinking about the findings you...
-
John and Nina Hartwick, married 17 years, have a 13-year-old daughter. Eight years ago, they purchased a home on which they owe about $240,000. They also owe $6,000 on a two-year-old automobile. All...
-
What is the WACC using divinded model? Stephed Limited's current capital structure consists of bonds with a Face Value of 12M with coupon payments are semi-annual at a rate of 2.50%pa. Otherwise,...
-
A 900.0 kg roller coaster car starts from rest at point A, rolls down the track, goes around a loop (points B and C) and then flies off the inclined part of the track (point D). The dimensions are: H...
-
Derive Newton's second law using the Lagrangian formulation of classical mechanics Part B) Derive Newton's second law using the Hamiltonian formulation of classical mechanics
-
2. The acceleration due to gravity near the surface of Mars is 3.69 m/s. One morining, an astronaut tests her jetpack. Starting from rest, the jetpack accelerates her upward from the ground with a...
-
Suppose a chemist discovers a new metallic element and names it "Xtrinsium" (Xt). Xt exhibits chemical behaviour similar to an alkaline earth. Xt(s) + Cl(g) XtCl(s) - Lattice energy for XtCl First...
-
According to Dalton's atomic theory a b no two atoms of given element are exactly alike. only compounds are made of atoms. d atoms cannot be subdivided, created, or destroyed. atom is composed of...
-
Let C be an arbitrary collection of subsets of a set X. Show that for a given A o(C), there exists a countable sub-collection CA of C depending on A such that A (CA). (We say that every member of...
-
In Problem use absolute value on a graphing calculator to find the area between the curve and the x axis over the given interval. Find answers to two decimal places. y = x 3 ln x; 0.1 x 3.1
-
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...
-
A manager has been using a certain technique to forecast demand for project man- agement software at her store. Actual demand and her corresponding predictions are shown below: a. What was the...
-
Why aren't the effective capacity and the optimal operating level of any operation necessarily the same amount of activity?
-
A certain facility has a design capacity of 2,500 units a day and an effective capacity of 2,225 units. Name one potential determinant of its effective capacity.
Study smarter with the SolutionInn App