DATA EQU 20H
N EQU 8
ISRT:
MOV DPTR,#LIST
MOV R0,#DATA
MOV R2,#N
CPY:
CLR A
MOVC A,@A+DPTR
MOV @R0,A
INC R0
INC DPTR
DJNZ R2,CPY
LCALL INSSORT
STOP:
LJMP STOP
LIST:
DB 53H,87H,12H,9AH
DB 2FH,3CH,0A8H,0BCH
INSSRT:
MOV R3,#1
MOV R2,#N-1
LOOP0:
MOV A,R3
MOV R4,A
ADD A,#DATA
MOV R0,A
DEC A
MOV R1,A
MOV B,@R0
LOOP1:
MOV A,@R1
SETB C
SUBB A,B
JC LOOP2
MOV A,@R1
MOV @R0,A
DEC R0
DEC R1
DJNZ R4,LOOP1
LOOP2:
MOV @R0,B
INC R3
DJNZ R2,LOOP0
RET