资源描述:
《北京交通大学微机上机实验报告》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
1、18.编写程序,将MBUF为起始单元的5个数按相反次序传送到NBUF开始的存储单元中AGAIN:MOVAL,[SI-1]ORAL,30HMOV[DI],ALDECSIINCDILOOPAGAINMOVAL,'$'MOV[DI],ALMOVDX,OFFSETNBUFMOVAH,09HINT21HMOVAH,4CHINT21HCODEENDSENDSTARTDATASEGMENTMBUFDB5,8,3,7,5COUNTEQU$-MBUFNBUFDB6DUP(?)DATAENDSCODESEGMENTASSUMECS:CODE,DS:DATASTART:MOVAX,DATAMO
2、VDS,AXMOVSI,OFFSETMBUFMOVDI,OFFSETNBUFMOVCX,COUNTADDSI,CX20.编写程序,将内存中某数据块中的正数和负数分开,并分别将这些正数和负数送同一数据段的两个缓冲区中,并在屏幕上显示正数和负数的个数(数据自定)。DATASEGMENTD1DB1,3,-1,-3,4,0,2COUNTEQU$-D1D2DB100DUP(?)D3DB100DUP(?)PNUMDW?NNUMDW?CONSTDW10000,1000,100,10,1DECSDB5DUP(0)HEAD1DB"THENUMBEROFPOSITIVENUMBERIS:$"
3、HEAD2DB"THENUMBEROFNEGATIVENUMBERIS:$"DATAENDSMOVAH,09HLEADX,HEAD2INT21HMOVAX,NNUMCALLDISPLAYMOVDL,0AHMOVAH,02HINT21HMOVDL,0DHMOVAH,02HINT21HMOVAH,4CHINT21HDISPLAYPROCNEARMOVCX,5LEASI,CONSTLEADI,DECSCONV:MOVBL,0AGAIN1:SUBAX,[SI]JCNEXTINCBLJMPAGAIN1NEXT:ADDAX,[SI]ORBL,30HMOV[DI],BLINCSIINC
4、SIINCDILOOPCONVMOVAH,02HMOVCX,5LEADI,DECSCONV1:MOVDL,[DI]CMPDL,30HJNZCONV3INCDILOOPCONV1STACKSEGMENTSTACKDB100DUP(?)STACKENDSCODESEGMENTASSUMECS:CODE,DS:DATA,SS:STACKSTART:MOVAX,DATAMOVDS,AXLEABX,D1LEASI,D2LEADI,D3MOVCX,COUNTAGAIN:MOVAL,[BX]CMPAL,0JGELOP1MOV[DI],ALINCDIINCNNUMJMPLOPLOP1:J
5、GLOP2JMPLOPLOP2:MOV[SI],ALINCSIINCPNUMLOP:INCBXLOOPAGAINMOVAH,09HMOVDX,OFFSETHEAD1INT21HMOVAX,PNUMCALLDISPLAYMOVDL,0AHMOVAH,02HINT21HMOVDL,0DHMOVAH,02HINT21HCONV3:INT21HCMPCX,0JZQUITINCDIMOVDL,[DI]LOOPCONV3QUIT:RETDISPLAYENDPCODEENDSENDSTART21.编写程序,从内存BLOCK开始,存放着10个字节的有符号数,从这些数中找出绝对值最大的数,
6、将其存入MAX中。AGAIN:MOVAL,[SI]CMPAL,0JGELOPNEGALLOP:CMPAL,BLJBELOP1XCHGAL,BLLOP1:INCSILOOPAGAINADDBL,30HMOVMAX,BLMOVDL,BLMOVAH,02HINT21HMOVAH,4CHINT21HCODEENDSENDSTARTDATASEGMENTBLOCKDB1,-1,4,-3,8,9,-5,3,-1,2COUNTEQU$-BLOCKMAXDB?DATAENDSSTACKSEGMENTSTACKDB100DUP(0)STACKENDSCODESEGMENTASSUMECS:
7、CODE,DS:DATA,SS:STACKSTART:MOVAX,DATAMOVDS,AXMOVSI,OFFSETBLOCKMOVBL,0MOVAH,0MOVCX,COUNT26.编写程序,将内存中N个无符号数据从大到小排序后输出显示LOP1:MOVSI,CXMOVDI,1LEABX,BUFLOP2:MOVAL,[BX]CMPAL,[BX+1]JAELOP3XCHGAL,[BX+1]MOV[BX],ALMOVDI,0LOP3:INCBXLOOPLOP2CMPDI,0JNZOKMOVCX,SILOOPLOP1OK:MOVCX,N