Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For this week s programming, we will be implementing basic operations on integer values. We have two source registers ( R 1 and R 2

For this weeks programming, we will be implementing basic operations on integer values. We have
two source registers (R1 and R2 with values x and y, respectively), and another register (R4) whose
value (z) dictates which operation should be performed on x and y.
First, you must read the value z in register R4. We then look at its value:
if z >0: we perform multiplication (x y);
if z =0: we perform addition (x + y);
if z <0: we perform subtraction (y x).
The result of this operation should be stored in register R3. Please note:
1. You do not have to convert the negative values into their decimal notation when doing any of
the operations;
2. For subtraction, make sure that you perform it in the right order on x and y (so y x, not
x y);
3. For addition, the order does not matter;
4. For multiplication, we also expect that if x <0 and y <0, then x y >0(in other words,
multiplying two negative numbers should yield a positive number)
Note that you must make sure that you implement an efficient way of doing multiplication. In assembly lc3

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions