This is descending. How would I swap to ascending so that when LMC outputs the numbers it shows in ascending order.
INP
STA A
INP
STA B
LDA A
SUB B
BRP BTOS
BRA BTOS2
BTOS LDA A
OUT
LDA B
OUT
BTOS2 LDA B
OUT
LDA A
OUT
A DAT
B DAT
You just have the logic backwards. You are checking if A - B is positive (i.e. A is larger) and if it is you are outputting A then B, which is descending. You also need to halt the program after the BTOS branch ends, otherwise you will jump to the second condition after the first completes in the case that B is greater than A
You also need to halt the program after the BTOS branch ends, otherwise you will jump to the second condition after the first completes in the case that B is greater than A.