Question
1.1. Multiplication Write a multiplication subroutine that takes two values and multiplies them together. The two input values should be stored in R1 and R2
1.1. Multiplication Write a multiplication subroutine that takes two values and multiplies them together. The two input values should be stored in R1 and R2 before multiplication is called, and the result should be stored in R0 before multiplication returns. Write multiplication to start at x3100. Lecture 7 has a pretty strong start on this subroutine already.
1.2. Division Write a division subroutine that takes two values and divides the first by the second. The numerator should be stored in R1 and the denominator in R2 before division is called, and the result should be stored in R0 before division returns. Since LC-3 only has integers, any remainder should be ignored. Think about how division can be implemented with the tools that we have already addition and subtraction. Write division to start at x3200.
1.3. Modulo Write a modulo subroutine that takes two values and mods the first by the second. As a reminder, a mod b gives the remainder of a b. The dividend should be stored in R1 and the divisor in R2 before modulo is called, and the result should be stored in R0 before modulo returns. Write modulo to start at x3300.
1.4. Simple test Write some code to test your three operations. Put 5 in R1 and 3 in R2 before each your tests. That way you can test that R0 is 15 after multiplication, 1 after division, and 2 after mod. You dont need to print anything out in the test this is a test that you will step through in debug mode to verify your R0 return values. Write the test to start at x3000 (so all of your operators should be branching/jumping back to the appropriate location in your test code).
PLEASE ANSWER ALL PARTS OR DONT ANSWER
1.1. Multiplication Write a multiplication subroutine that takes two values and multiplies them together. The two input values should be stored in R1 and R2 before multiplication is called, and the result should be stored in Ro before multiplication returns. Write multiplication to start at x31oo. Lecture 7 has a pretty strong start on this subroutine already 1.2. Division Write a division subroutine that takes two values and divides the first by the second. The numerator should be stored in R1 and the denominator in R2 before division is called, and the result should be stored in Ro before division returns. Since LC-3 only has integers, any remainder should be ignored. Think about how division can be implemented with the tools that we have already addition and subtraction. Write division to start at x320o 1.3 Modulo Write a modulo subroutine that takes two values and mods the first by the second. As a reminder, a mod b gives the remainder of a b. The dividend should be stored in R1 and the divisor in R2 before modulo is called, and the result should be stored in Ro before modulo returns. Write modulo to start at x33oo. 1.4. Simple test Write some code to test your three operations. Put 5 in R1 and 3 in R2 before each your tests. That way you can test that Ro is 15 after multiplication, 1 after division, and 2 after mod. You don't need to print anything out in the test this is a test that you will step through in debug mode to verify your Ro return values. Write the test to start at x30oo (so all of your operators should be branching/jumping back to the appropriate location in your test code)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started