Question: Using the MARIE computer assembly language, write a program that computes the following expression: z ( a * b ) * ( c * d

Using the MARIE computer assembly language, write a program that computes the following expression:
z (a * b)*(c * d)* e. The computer will read in the input values a, b, c, d, and e from the keyboard,
and the final result (z) has to be displayed. In addition, every time an input value is read in, it must be
validated by checking that the input is a positive number. If it is positive display the number on the
screen; otherwise display zero and end the program. Each time a multiplication of two numbers is needed,
it has to be done using a multiplication subroutine. Remember that the MARIE instruction set does not
have an instruction to execute multiplication, you must create a subroutine (function) that multiplies two
numbers and call it each time you need it. The program must be tested in the MARIE simulator
I made a code but my calculations are wrong. For example if I input the value 2 for every variablw I get 120 instead of 32. This is my code that I need help with editing.
//Jamoy Hardy
ORG 100
Input
Output
Store A
Skipcond 800
Jump zeroError
Input
Output
Store B
Skipcond 800
Jump zeroError
Input
Output
Store C
Skipcond 800
Jump zeroError
Input
Output
Store D
Skipcond 800
Jump zeroError
Input
Output
Store E
Skipcond 800
Jump zeroError
Load A
Store var1
Load B
Store var2
jns mySubroutine
Load X
Output
Store res1
Load C
Store var1
Load D
Store var2
jns mySubroutine
Load X
Store res2
Load res1
Store var1
Load res2
Store var2
jns mySubroutine
Load X
Store res3
Load res3
Store var1
Load E
Store var2
jns mySubroutine
Load X
Store res4
Output
Halt
mySubroutine, HEX 0
Loop, Load X
Add var1
Store X
Load var2
Subt One
Store var2
Skipcond 400
Jump Loop
JumpI mySubroutine
zeroError, Load 0
Output
Halt
A, DEC 0
B, DEC 0
C, DEC 0
D, DEC 0
E, DEC 0
var1, DEC 0
var2, DEC 0
X, DEC 0
res1, DEC 0
res2, DEC 0
res3, DEC 0
res4, DEC 0
One, DEC 1
result, DEC 0

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!