冒泡排序
刚刚完成了一个数据排序程序的设计(用冒泡法将片内从30H单元开始的10个无符号数,按从大到小的顺序排列),写的很繁琐,请高手精简一下吧!ORG 30H
MOV 30H,#20H
MOV 31H,#45H
MOV 32H,#32H
MOV 33H,#65H
MOV 34H,#69H
MOV 35H,#43H
MOV 36H,#54H
MOV 37H,#89H
MOV 38H,#76H
MOV 39H,#87H
MOV R6,#30H
MOV R7,#31H
MOV R2,#09H
LOOP:
MOV A,R6
MOV R0,A
MOV A,R7
MOV R1,A
MOV A,R2
MOV R3,A
CLR CY
LOOP0: MOV A,@R0
MOV 22H,@R1
CJNE A,22H,LOOP1
LOOP1: JC LOOP2
SJMP INT
LOOP2:
CLR CY
MOV 20H,@R0
MOV 21H,@R1
MOV @R0,21H
MOV @R1,20H
SJMP INT
INT: INC R1
DJNZ R3,LOOP0
INC R6
INC R7
DJNZ R2,LOOP
END