Reference no: EM132215
Attached file "add_two_numbers.mas" is a MARIE program to do plain addition of two number already stored in memories (Num1, Num2).
Answer is stored at Result and also put in Output window
(the Output Register).
RUN the program and confirm that it works in your downloaded copy of the MARIE Simulator.
(2) MODIFY (Make another program based on that one)
Copy that file and rename copy "Add_Four_if_result_positive.mas".
Change that program in two ways-
(a) Make it add four numbers (Num1, Num2, Num3, Num4) in its place of the two it originally handled.
(b) Include a decision before storing and outputing result. If value of the result is not positive (so zero or negative), set
Result value to the value ZERO (0).
So, program will implement this kind of logic-
Result = Num1 + Num2 + Num3 + Num4;
If (Result < 1) Result = 0;
This will require figuring out how SkipCond instruction works and whether to give it a Hex operand of 000, 400, or 800.