资源描述:
《8086汇编经典例程.doc》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、==========================================5.编写一个数组排序(从小到大)的小程序,数组在程序中定义,程序先将原数组显示一遍,然后排序,再将排好序的数组显示一遍。==========================================AAASEGMENTBUFDB'6455412345$'L=$-BUFarydw-897,345,6789,8654,-1234,-3456,-99,-678,987,567,32762,-12121,0,3434,4645,-234,23455,-100,100,1000,-1
2、000dw572,-2345,-6543,-1234,9999lendw($-ary)/2ASSUMECS:AAA,DS:AAAMAINPROCFARPUSHCSPOPDSLEASI,ARYMOVCX,LENNEXT3:MOVBX,[SI]CALLDISPCALLSPACEADDSI,2LOOPNEXT3CALLCRLFCALLCRLFLEASI,ARYMOVCX,LENCALLSORTLEASI,ARYMOVCX,LENNEXT5:MOVBX,[SI]CALLDISPCALLSPACEADDSI,2LOOPNEXT5MOVAH,4CHINT21HMAINEND
3、PDISPPROCPUSHSIPUSHAXPUSHBXPUSHDXPUSHCXMOVCX,0CMPBX,0JNLNEXT1NEGBXMOVCX,1NEXT1:LEASI,BUF+l-1MOVAX,BXMOVBX,10NEXT:MOVDX,0DIVBXADDDL,30HDECSIMOV[SI],DLCMPAX,0JNENEXTCMPCX,0JENEXT2DECSIMOVBYTEPTR[SI],'-'NEXT2:MOVDX,SIMOVAH,9INT21HPOPCXPOPDXPOPBXPOPAXPOPSIRETDISPENDPSORTPROCNEXTT:PUSHCXM
4、OVDI,SIMOVAX,[SI]NEXT0:CMPAX,[DI]JLNEXTQMOVBX,AXMOVAX,[DI]MOV[DI],BXNEXTQ:ADDDI,2LOOPNEXT0MOV[SI],AXADDSI,2POPCXLOOPNEXTTRETSORTENDPCRLFPROCPUSHAXPUSHDXMOVDL,13MOVAH,2INT21HMOVDL,10INT21HPOPDXPOPAXRETCRLFENDPSPACEPROCPUSHAXPUSHDXMOVDL,''MOVAH,2INT21HPOPDXPOPAXRETSPACEENDPAAAENDSENDMA
5、IN===============================================5.编写一个程序,从键盘输入10个十进制数字字符,然后将这些数字加密存储在缓冲区BUFFER中。加解密表如下:==========================================qqqsegmentTAB1DB'QWERTYUIOPASDFGHJKLZXCVBNM'TAB2DB'qazwsxedcrfvtgbyhnujmikolp'TAB3DB')(*&^%/#@!'LEN=$-tab1MSS1DB13,10,'Pleasechoseafunctio
6、c:',0DH,0AHDB'1--jiami',0DH,0AHDB'2---jiemi',13,10DB'0--exit$'MSS2DB0dh,0ah,'Error!Youhavepress""key!$'MM1DB'Yourinputis:'BUF1DB255DUP(?)MM2DB'Myoutputis:'BUF2DB255DUP(?)qqqendscccsegmentassumecs:ccc,ds:qqqmainprocfarstart:movax,qqqmovds,axrep1:callcrlfLEASI,BUF1LEADI,BUF2leadx,mss1;
7、显示菜单movah,9int21hmovah,1;输入你的选项int21hcmpal,'0';输入0,结束jequitcmpal,'1';输入1,加密jejiamicmpal,'2';输入2,解密jejiemimov[mss2+25],al;其他字符,错误,重输入leadx,mss2movah,9int21hjmprep1quit:movah,4chint21hjiami:callcrlfnext1:movah,1int21hcmpal,27jeNEXT14MOV[SI],ALcmpal,'A'jnaenext3cmpal,'Z'janext3subal,'A'
8、leabx,tab1jm