[問題]8051氣泡排序減少次數 問題
DSEG AT 30H
DSIZE EQU 08H
TDATA: DS DSIZE
COUNT: DS 1 ^^
;
;
;
CSEG AT 0000H
^^ MOV COUNT,#00H
BUBSORT:MOV R0,#LOW TDATA
MOV R1,#LOW TDATA+1
MOV R2,#DSIZE
^^ CLR C
^^ SUBB R2,COUNT
MOV B,#00H
CMPXCHG:MOV A,@R0
CLR C
SUBB A,@R1
JC NEXT
MOV A,@R0
XCH A,@R1
MOV @R0,A
ORL B,#01H
NEXT: INC R0
INC R1
DJNZ R2,CMPXCHG
INC COUNT
^^ MOV A,B
JNZ BUBSORT
RET
END
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 220.143.53.162
→
04/20 11:29, , 1F
04/20 11:29, 1F
→
04/20 11:30, , 2F
04/20 11:30, 2F
→
04/20 11:30, , 3F
04/20 11:30, 3F
ASM 近期熱門文章
PTT數位生活區 即時熱門文章