8051 Assembly Code to Sort the Numbers in Ascending Order. The Data is stored in RAM location 40H, And the Ascending order is stored in RAM location 50H.
ORG 0000H
MOV R7,#4
loop1:MOV R0,#40H
MOV R6,#04
loop:MOV A,@R0
INC R0
MOV 50H,@R0
CJNE A,50H,next
SJMP down
next:JC down
MOV @R0,A
DEC R0
MOV @R0,50H
down:DJNZ R6,loop
DJNZ R7,loop1
END