Use MARIE Simulator to enter and run the following program:
Input
Store TestVal
If, Skipcond 800
Jump Else
Then, Store Y
Add Y
Jump EndIf
Else, Load Y
EndIf, Add X
Add X
Store Z
Output
Halt
X, Dec 5
Y, Dec 2
Z, Dec 0
TestVal, Dec -1
instructions:
c) Based on your answer in part b, formulate what happens in the three cases, by stating the output as a function of the variables (for example, Output= 3x-2a+y)
Input
Store TestVal
If, Skipcond 800
Jump Else
Then, Store Y
Add Y
Jump EndIf
Else, Load Y
EndIf, Add X
Add X
Store Z
Output
Halt
X, Dec 5
Y, Dec 2
Z, Dec 0
TestVal, Dec -1
instructions:
- Use “ORG” instruction to start your program at address 100.
- Use your last university ID number when you are asked to input a number. For example, if your ID is1415161678532, then you will use the number 2.
c) Based on your answer in part b, formulate what happens in the three cases, by stating the output as a function of the variables (for example, Output= 3x-2a+y)