① 编写排序程序,将地址为30h~3fh的片内数据存储器中的数据进行降序排序 (单片机8051系列的
_sort SEGMENTCODE
PUBLIC sort
RSEG_sort
sort:
MOV R0,#30H
R0_FOR_CMP:
MOVA,R0
ADDA,#256-3FH
JZR0_FOR_END
MOVA,R0
INCA
MOVR1,A
R1_FOR_CMP:
MOVA,R1
ADDA,#256-40H
JZR1_FOR_END
CLRC
MOVA,@R0
SUBB模宏败A,@R1
JNCR1_FOR_ADJ
;SWAP
MOVA,@R0
XCHA,@R1
XCHA,@R0
R1_FOR_ADJ:
INCR1
AJMPR1_FOR_CMP
R1_FOR_END:
R0_FOR_ADJ:
INC旦颤R0
AJMP绝伏R0_FOR_CMP
R0_FOR_END:
RET
END