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...
-
UnitedHealth Group Incorporated is a diversified health and well-being company dedicated to helping people live healthier lives. The company operates under two distinct platforms: health benefits...
-
1,2,3,4,5-Pentafluoro-6-nitrobenzene reacts readily with sodium methoxide in methanol at room temperature to yield two major products, each having the molecular formula C7H3F4NO3. Suggest reasonable...
-
What electronic information is discoverable?
-
Tropical Sun Ltd. makes suntan lotion in two stages. The lotion is rst blended in the Blending Department and then bottled and packed in the Bottling Department. The following information relates to...
-
Donde lends 20,000 to Kyle today and charges a nominal interest rate of 7.5% convertible monthly. Kyle will repay the loan by level payments at the end of each month in the next 5 years. Donde will...
-
The Bulgarian lev is currently pegged to the euro. Using ISLM diagrams for Home (Bulgarian lev) and Foreign (Eurozone), illustrate how each of the following scenarios affects the Bulgarian lev....
-
Instructions Note: This is individual assignment. Any attempt to copy from other will affect your marks. Part II: You will be assigned a country to study and compare with Saudi Arabia, which will be...
-
We are given the following information for Pettit Corporation. Sales (credit) Cash Inventory Current liabilities Asset turnover Current ratio Debt-to-assets ratio Receivables turnover $4,344,000...
-
Meet Jackie. She has a phobia of dogs that she has had since she was 3 years old. When Jackie was 3, she was playing in her yard and a neighbors dog came up to her and bit her hand. Jackie had to go...
-
Problem 1 The following information are presented to you in connection with the determination of the fringe benefits tax of the general manager of Orchids merchandising for 2023: Paid by the company...
-
-Convert 357 km into miles -Convert 2.40 mm into inch. -The density of the lightest metal lithium is 5.34 X 10 3 kg/m 3 . Convert the density to g/cm 3
-
Electron Americas can manufacture the new smartphones at 50% of the sales revenue. Fixed costs for the operation are estimated to run $4.3 million per year. The estimated sales volume is 75,000,...
-
Explain the Efficient production and the production possibilities frontier.
-
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...
-
For each of the following events concerning disclosure of events that took place after year end, discuss the manner in which it should be disclosed in the financial statements or the audit report....
-
Determining whether a subsequent event requires an adjustment to the financial statements is difficult in many circumstances. Discuss the primary difference between subsequent events that require...
-
Each of the following techniques for managing earnings was described in the chapter: - "Big Bath" charges - Write-off of acquired assets - "Cookie Jar" reserves - Abuse of materiality - Questionable...
Study smarter with the SolutionInn App