西安电子科技大学微机原理上机题37题

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

编写程序实现将缓冲区BUFFER中的100个字按递增排序,并按下列格式顺序显示:数据1原序号数据2原序号数据3原序号················程序如下(效果图):N=100DATASSEGMENTBUFFERLABELWORDX=55519REPT100X=(X+7517)mod65535DWXENDMNUMBERLABELBYTEY=0REPT100Y=Y+1DBYENDMDECIMALDB5DUP(?)MDW1DUP(?)DATASENDSSTACKSSEGMENTDW100HDUP(?)TOPLABELWORDSTACKSENDSCODESSEGMENTASSUMECS:CODES,DS:DATAS,SS:STACKSSTART:MOVAX,DATASMOVDS,AXMOVES,AXMOVAX,STACKSMOVSS,AXLEASP,TOPXORAX,AX;开始程序LEASI,BUFFERLEADI,NUMBERCALLSORTMOVCX,N;显示程序开始L1:MOVAX,[SI]MOVM,5CALLDISPAXDCALLDISPEMADDSI,2;显示数值XORAX,AXMOVAL,[DI]MOVM,3CALLDISPAXDCALLDISPCRINCDI;显示序号LOOPL1MOVAH,4CHMOVAL,0INT21HSORTPROCNEARPUSHSIPUSHDIPUSHAXPUSHBXPUSHCXMOVCX,N;开始冒泡程序DECCXLP1:;外循环PUSHSIPUSHDIPUSHCXLP2:;内循环MOVAX,[SI]CMPAX,[SI+2]JBENOXCHGXCHGAX,[SI+2]MOV[SI],AXMOVBL,[DI]XCHGBL,[DI+1]MOV[DI],BLNOXCHG:ADDSI,2INCDILOOPLP2POPCXPOPDIPOPSILOOPLP1;冒泡结束POPCXPOPBXPOPAXPOPDIPOPSIRETSORTENDPDISPAXDPROCNEARPUSHAXPUSHBXPUSHCXPUSHDXPUSHDILEADI,DECIMALCALLTRANS16TO10MOVCX,MMOVBX,CXDECBXLEADI,DECIMAL[BX];指向最高位MOVAH,2DISPAXD2:MOVDL,[DI]ADDDL,30HDECDIINT21HLOOPDISPAXD2POPDIPOPDXPOPCXPOPBXPOPAXRETDISPAXDENDPTRANS16TO10PROCNEARPUSHAXPUSHBXPUSHCXPUSHDXPUSHDIMOVBX,10MOVCX,MTRANS1:XORDX,DXDIVBXMOV[DI],DLINCDILOOPTRANS1POPDIPOPDXPOPCXPOPBXPOPAXRETTRANS16TO10ENDPDISPEMPROCNEARPUSHAXPUSHDXMOVAL,20HMOVAH,02MOVDL,ALINT21H;显示一位字符POPDXPOPAXRETDISPEMENDPDISPCRPROCNEARPUSHAXPUSHDXMOVAL,0AHMOVAH,02MOVDL,ALINT21H;显示一位字符POPDXPOPAXRETDISPCRENDPCODESENDSENDSTART

1 / 5
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功