Doubts when implementing a program in the MARIE simulator

Thread Starter

Samuel94

Joined Dec 14, 2019
1
Hello everyone, I am a new member since forum and I am starting my programming training initially with the implementation of programs in the MARIE simulator. The proposed exercise is as follows, read two positive values and show them in descending order. Entering the values if the first is greater than the second then the result is correct, but if the first value is smaller then the result is not in descending order as intended.
At this point I can only use the following statements: Add, Subt, Load, Store, Input. Output, Jump, Skipcond and Halt.
The program code is this

INPUT
STORE A
INPUT
STORE B
SKIPCOND 800
JUMP L2
JUMP L1
L2, LOAD A
OUTPUT
L1, LOAD B
OUTPUT
SKIPCOND 000
JUMP Amenor
JUMP Bmenor
Amenor, LOAD A
OUTPUT
HALT
Bmenor, LOAD B
OUTPUT
HALT
A, DEC 0
B, DEC 0


Thank you in advance for all the attention and help you can give me.
 
Top