Need some assistance with MARIE assembly language program. I have written a program to sort through an array of 5 numbers and count the number of negative and positive numbers, now I need to sort and arrange them in ascending order. I cannot find a way to get them to sort and gather an output in ascending order. Please see my code below. Any assistance would be greatly appreciated.
ORG 100
If, LoadI Addr /Load element found at address Addr.
Skipcond 800 /IF AC > 0, skip to next instruction.
Jump Else /Otherwise, Jump to Else.
Then, Load Addr /Load element in at Addr.
Add One /NNeg + 1
Store Addr /Store Addr.
Load NNeg /Load NNeg.
Add One /Increment NNeg by 1.
Store NNeg /Store NNeg count.
Load N /Load Array number.
Subt One /Subtract 1 from Array.
Store N /Store new Array count.
Skipcond 400 /If AC = 0, Halt Program.
Jump If /Jump to If.
Else, Load Addr /Load element in Addr
Add One /Add 1 to Neg
Store Addr /Store Addr.
Load Neg /Load Neg.
Add One /Increment Neg by 1.
Store Neg /Store Neg count.
Load N /Load Array number.
Subt One /Subtract 1 from Array.
Store N /Store new Array count.
Skipcond 400 /If AC = 0, Halt Program.
Jump If /Jump to If.
EndIf, Halt /Terminate Program.
One, Dec 1 /Set One to 1.
N, Dec 5 / Number of array elements.
NNeg, Dec 0 / Number of values >= 0.
Neg, Dec 0 / Number of values < 0.
Addr, Hex 11F /Beginning Address.
Dec 18 /First element in Array.
Dec -3 /Second element in Array.
Dec 10 /Third element in Array.
Dec 1 /Fourth element in Array.
Dec -3 /Fifth element in Array.
ORG 100
If, LoadI Addr /Load element found at address Addr.
Skipcond 800 /IF AC > 0, skip to next instruction.
Jump Else /Otherwise, Jump to Else.
Then, Load Addr /Load element in at Addr.
Add One /NNeg + 1
Store Addr /Store Addr.
Load NNeg /Load NNeg.
Add One /Increment NNeg by 1.
Store NNeg /Store NNeg count.
Load N /Load Array number.
Subt One /Subtract 1 from Array.
Store N /Store new Array count.
Skipcond 400 /If AC = 0, Halt Program.
Jump If /Jump to If.
Else, Load Addr /Load element in Addr
Add One /Add 1 to Neg
Store Addr /Store Addr.
Load Neg /Load Neg.
Add One /Increment Neg by 1.
Store Neg /Store Neg count.
Load N /Load Array number.
Subt One /Subtract 1 from Array.
Store N /Store new Array count.
Skipcond 400 /If AC = 0, Halt Program.
Jump If /Jump to If.
EndIf, Halt /Terminate Program.
One, Dec 1 /Set One to 1.
N, Dec 5 / Number of array elements.
NNeg, Dec 0 / Number of values >= 0.
Neg, Dec 0 / Number of values < 0.
Addr, Hex 11F /Beginning Address.
Dec 18 /First element in Array.
Dec -3 /Second element in Array.
Dec 10 /Third element in Array.
Dec 1 /Fourth element in Array.
Dec -3 /Fifth element in Array.