资源描述:
《微型计算机原理与接口技术课后答案资料》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、15.已知:在内存BUF开始的单元中,存在一串数据:58,75,36,42,89。编程找出其中的最小值存入MIN单元中,并将这个数显示在屏幕上。解:STACKSEGMENTSTACKDB100DUP(?)STACKENDSDATASEGMENTBUFDB58H,75H,36H,42H,89HMINDB0DATAENDSCODESEGMENTASSUMECS:CODE,DS:DATA,SS:STACKSTART:PUSHDSMOVAX,DATAMOVDS,AXMOVCX,4MOVBX,OFFSETBUFMOVAL,[BX]ST1:INCBXCMPAL,[BX]JBENEXTMOVA
2、L,[BX]NEXT:LOOPST1MOVMIN,ALANDAL,0F0HMOVCL,4RORAL,CLADDAL,30HMOVDL,ALMOVAH,02HINT21HMOVAL,MINANDAL,0FHADDAL,30HMOVDL,ALMOVAH,02HINT21HPOPDSMOVAH,4CHINT21HHLTCODEENDSENDSTART18.某班有20个同学的微机原理成绩存放在LIST开始的单元中,要求编程先从高到低的次序排列好,再求出总分和平均值,分别存放在SUM和AVER开始的单元中。解:STACKENDSDATASEGMENTLISTDB65H,76H,78H,54
3、H,90H,85H,68H,66H,77H,88HDB99H,89H,79H,69H,75H,85H,63H,73H,83H,93HSUMDW0AVERDB0BUFDB100DUP(?)DATAENDSCODESEGMENTASSUMECS:CODE,DS:DATA,SS:STACKSTART:PUSHDSMOVAX,DATAMOVDS,AXMOVDI,OFFSETLISTMOVBX,19LP0:MOVSI,DIMOVCX,BXLP1:MOVAL,[SI]INCSICMPAL,[SI]JNCLP2MOVDL,[SI]MOV[SI-1],DLMOV[SI],ALLP2:LOOPLP
4、1DECBXJNZLP0LP3:MOVCX,20MOVBX,OFFSETLISTMOVSUM,0XORAX,AXLP4:ADDAL,[BX]DAAADCAH,0INCBXLOOPLP4MOVSUM,AXMOVBL,20HDIVBLADDAL,0DAAMOVAVERALPOPDSHLTCODEENDSENDSTART20.编程将存放在AL中的无符号二进制数,转化成十六进制数,再转换成ASII码并显示在屏幕上。解:程序如下:STACKSEGMENTSTACKDB100DUP(?)STACKENDSDATASEGMENTDB100DUP(?)DATAENDSCODESEGMENTASS
5、UMECS:CODE,DS:DATA,SS:STACKSTART:PUSHDSMOVAX,DATAMOVDS,AXMOVDH,ALMOVCH,02HST1:MOVCL,4RORDH,CLMOVAL,DHANDAL,0FHADDAL,30HCMPAL,39HJBEDISPADDAL,07HDISP:MOVDL,ALMOVAH,02HINT21HDECCHJNZST1POPDSMOVAH,4CHINT21HHLTCODEENDSENDSTART21.编写程序,使用三种以上的方法,将存储器中2000H开始的地址单元中的100字节数据复制到3000H开始的存储器地址单元中。解:(1)利用
6、通用传送指令MOVMOVSI,2000H注意这里如果是标号地址,则必须用OFFSETMOVDI,3000HMOVCX,100LP1:MOVAL,[SI]MOV[DI],ALINCSIINCDILOOPLP1HLTMOVCX,100MOVBX,0LP0:MOVAL,2000[BX]MOV3000[BX],ALINCBXLOOPLP0HLT(2)利用交换指令XCHGMOVSI,2000HMOVDI,3000HMOVCX,100LP2:MOVAL,[SI]XCHG[DI],ALINCSIINCDILOOPLP2HLT(3)利用换码指令XLATMOVBX,2000HMOVDI,3000H
7、MOVCX,100LP3:XORAL,ALXLATMOV[DI],ALINCBXINCDILOOPLP3HLT(4)利用堆栈实现数据传送MOVSI,2000HMOVDI,3000HMOVCX,50LP4:PUSH[SI]POP[DI]INCSIINCSIINCDIINCDILOOPLP4HLT(5)利用串操作指令REPMOVSBMOVSI,2000HMOVDI,3000HMOVCX,100CLD;DF=0,SI、DI自动+1REPMOVSBHLT5.对于下面的数据定义,各条MOV