DATA EQU 20H
N EQU 8
SSSRT:
MOV DPTR,#LIST
MOV R0,#DATS
MOV R2,#N
CPY:
CLR A
MOVC A,@A+DPTR
MOV @R0,A
INC R0
INC DPTR
DJNZ R2,CPY
LCALL SELSORT
LIST:
DB 53H,87H,12H,9AH
DB 2FH,3CH,0A8H,0BCH
SLSRT:
MOV R0,#DATS
MOV R2,#N-1
LOOP0:
MOV B,@R0
MOV A,R0
MOV R3,A
INC A
MOV R1,A
MOV A,R2
MOV R4,A
LOOP1:
MOV A,@R1
CLR C
SUBB A,B
JNC LOOP2
MOV B,@R1
MOV A,R1
MOV R3,A
LOOP2:
INC R1
DJNZ R4,LOOP1
MOV A,R3
MOV R1,A
MOV A,@R1
XCH A,@R0
XCH A,@R1
INC R0
DJNZ R2,LOOP0
RET