Question

Using the MARIE computer assembly language, write a program that computes the following expression: z =...

Using the MARIE computer assembly language, write a program that computes the following expression:

z = a * b * c. The computer will read in the input values a, b, and c from the keyboard and the final result

(z) have to be displayed. In addition, every time an input value is read in, it must be displayed on the screen.

Remember that the instruction set does not have an instruction to execute multiplication.

The program

must be tested on MARIE simulator

This is the question that I need help on. I get the input<5> output<9> but im stuck after that. Please help

0 0
Add a comment Improve this question Transcribed image text
Answer #1

For the above mentioned output I have used two variables Sum1 and Sum2 for looping. Sum1 adds the first variable by the count of second variable. then the total is added to third variable. Result is your product.

ex: 4*3*5

(4+4+4) =12 ( Sum1 add 4 ,3  times)

(12+12+12+12+12) (Sum2 add 12 5 times) =60(Result)

The code is here:

Input
Store A
Input
Store B
Input
Store C

Load B
Store Count /Set count for B times

Loop1, Load A
Add Sum1
Output /Track process
Store Sum1

Load Count
Subt One
Store Count
Skipcond 800
Jump Count2
Jump Loop1

Count2, Load C
Store Count /Set count for C times

Loop2, Load Sum1
Add Sum2
Store Sum2 /Final Sum2 == Product
Output /Track process
Load Count
Subt One
Store Count
Skipcond 800
Jump End
Jump Loop2

End, Load Sum2
Output
Halt

A, Dec 0
B, Dec 0
C, Dec 0
Sum1, Dec 0
Sum2, Dec 0
Count, Dec 0
One, Dec 1

Can see the output attached in the image below :

Add a comment
Know the answer?
Add Answer to:
Using the MARIE computer assembly language, write a program that computes the following expression: z =...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT