Question
I need help with the following code. Right now it takes the input of 3 numbers and places them in numeric order with no spaces.
I need help with the following code. Right now it takes the input of 3 numbers and places them in numeric order with no spaces. So for example:
Input: 4 9 3
Output: 3 4 9
I want the output to be the following to be more clear: Smallest 3, Medium 4, Largest 9
Here is the code written in assembly in Pep8:
BR main
n1: .BLOCK 2 ;#2d
n2: .BLOCK 2 ;#2d
n3: .BLOCK 2 ;#2d
;
main: DECI n2,d
DECI n3,d
LDA n2,d
CPA n3,d
BRLT L1
DECI n1,d
LDA n1,d
CPA n3,d
BRLT L7
BR L6
STA n3,d
L1: DECI n1,d
LDA n2,d
CPA n1,d
BRLT L5
DECO n1,d
DECO n2,d
L2: DECO n3,d
STOP
L3: DECO n2,d
DECO n3,d
BR L9
L4: DECO n1,d
DECO n2,d
STOP
STA n1,d
L5: LDA n3,d
CPA n1,d
BRLT L3
DECO n2,d
DECO n1,d
BR L2
L6: DECO n3,d
LDA n1,d
CPA n2,d
BRLT L4
BR L8
L7: DECO n1,d
DECO n3,d
DECO n2,d
STOP
L8: DECO n2,d
L9: DECO n1,d
STOP
.END
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started