Question: I need help with my program. It not display anything each time I ' m running it though marie program. Here is the assignment: Using
I need help with my program. It not display anything each time Im running it though marie program. Here is the assignment: Using the MARIE computer assembly language, write a program that computes the following expression:
zlarr The computer will read in the input values and from the keyboard, the final
result 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. Remember that the MARIE instruction set does not have an instruction
to execute multiplication. The program must be tested in the MARIE simulator.
My Program:
ORG
InputA, DEC
InputB, DEC
InputC, DEC
InputD, DEC
ResultZ, DEC
Start, IN ; Input a
SKIPCOND ; Check if input is positive
JUMP InputError ; Jump to InputError if input is not positive
STORE InputA ; Store input in InputA
OUT ; Display the input
IN ; Input b
SKIPCOND ; Check if input is positive
JUMP InputError ; Jump to InputError if input is not positive
STORE InputB ; Store input in InputB
OUT ; Display the input
IN ; Input c
SKIPCOND ; Check if input is positive
JUMP InputError ; Jump to InputError if input is not positive
STORE InputC ; Store input in InputC
OUT ; Display the input
IN ; Input d
SKIPCOND ; Check if input is positive
JUMP InputError ; Jump to InputError if input is not positive
STORE InputD ; Store input in InputD
OUT ; Display the input
LOAD InputA ; Load InputA into accumulator
MUL InputB ; Multiply accumulator with InputB
STORE ResultZ ; Store result of first multiplication in ResultZ
LOAD InputC ; Load InputC into accumulator
MUL InputD ; Multiply accumulator with InputD
ADD ResultZ ; Add result of second multiplication to ResultZ
STORE ResultZ ; Store final result in ResultZ
OUT ; Display the final result
HLT ; Halt the program
InputError, LDA Zero ; Load into accumulator
OUT ; Display
HLT ; Halt the program
Zero, DEC
END
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
