4、CMOVA,#04HSUBBA,R0;j<5-iJCL1MOVR1,#30HLOOP1:MOVA,@R1MOVR2,ACLRCINCR1SUBBA,@R1JNCL2;大于跳轉(zhuǎn)MOVA,@R1DECR1MOV@R1,AINCR1MOVA,R2MOV@R1,ADJNZR3,LOOP1;內(nèi)次循環(huán)DECR4MOVA,R4MOVR3,AINCR0;外層循環(huán)i++SJMPLOOPL2:DECR3MOVA,R3CLRCSUBBA,#01HJCL1SJMPLOOP1L0:NOPL1:NOPSJMP$END選擇算法:ORG2000HMOV30H,#02HMOV
5、31H,#04HMOV32H,#01HMOV33H,#05HMOV34H,#03HMOVR3,#04HMOVR0,#04HLOOP:DECR0MOVA,R0CLRCSUBBA,#01HJCL1MOVR4,#04HMOVA,R4MOVR3,AMOVR1,#30HLOOP1:MOVA,@R1MOVR2,ACLRCINCR1SUBBA,@R1JNCL0MOVA,@R1DECR1MOV@R1,AINCR1MOVA,R2MOV@R1,ADJNZR3,LOOP1SJMPLOOPL0:DECR3MOVA,R3CLRCSUBBA,#01HJCLOOPSJMP
6、LOOP1L1:NOPSJMP$END四.實(shí)驗(yàn)結(jié)果分析冒泡算法:(輸入數(shù)據(jù):06H04H07H02H05H)選擇算法:(輸入數(shù)據(jù)04H02H01H05H03H)五.結(jié)論本次實(shí)驗(yàn)主要掌握對(duì)數(shù)據(jù)排序的兩種算法,理解冒泡排序和選擇排序算法的思想,通過C語言的理解設(shè)計(jì)匯編語言,運(yùn)用好循環(huán)語句,要有好的邏輯思考能力,對(duì)每一個(gè)數(shù)據(jù)的操作要清楚,對(duì)數(shù)據(jù)進(jìn)行交換的時(shí)候要掌握好指針的移動(dòng)