资源描述:
《微机原理与接口技术第3章习题课件.ppt》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、3-3写出执行下列程序段的中间结果和结果1.MOVAX,0809HMULAH;AX=AAM;AX=0048H0702H2.MOVAX,0809HMOVDL,5AAD;AX=DIVDL;AX=MOVDL,AHAAM;AX=DL=0059H0411H0107H04H3.MOVAX,0809HADDAL,AHMOVAH,0;AX=AAA;AX=0011H0107H4.MOVAX,0809HMOVDL,10XCHGAH,DLMULAH;AX=AAM;AX=ADDAL,DL;AX=005AH0900H0908H5.MOVAL,98HMOVAH,ALMOVCL,4SHRAH,CLANDAL,0F
2、HAAD;AL=H626.MOVCL,248XORAX,AXMOVCH,8AG:SHLCL,1ADCAL,ALDAAADCAH,AHDECCHJNZAG;AX=H02483-4编写程序,将字节变量BVAR中的压缩BCD数转换为二进制数,并存入原变量中。BVARDB99HMOVAL,BVARMOVCL,4SHRAL,CLMOVAH,10MULAHANDBVAR,0FHADDBVAR,AL本题还可以先将2位压缩BCD数转换为非压缩BCD数,然后用AAD指令将非压缩BCD数转换为二进制数。实现转换的程序段如下:MOVAL,BVARMOVAH,ALMOVCL,4SHRAH,CLANDAL,0
3、FHAADMOVBVAR,AL3-6编写求两个4位非压缩BCD数之和,将和送显示器显示的程序。D1DD06070809HD2DD04050607HOBFDB6DUP(0)MOVSI,0MOVDI,OFFSETOBF+5MOVBYTEPTR[DI],$MOVCX,4XORAH,AHAGAIN:MOVAL,BYTEPTRD1[SI]ADDAL,BYTEPTRD2[SI]ADDAL,AHMOVAH,0AAAADDAL,30HDECDIMOV[DI],ALINCSILOOPAGAINANDAH,AHJZNWW;无万位,转移DECDIMOVBYTEPTR[DI],1NWW:MOVDX,
4、DIMOVAH,9INT21H3-7编写求两个4位压缩BCD数之和,将和送显示器显示的程序。W1DW8931HW2DW5678HOBFDB6DUP(0)MOVAL,BYTEPTRW1ADDAL,BYTEPTRW2DAAMOVAH,ALMOVAL,BYTEPTRW1+1ADCAL,BYTEPTRW2+1DAAPUSHFMOVDIOFFSETOBF+5MOVBYTEPTR[DI],$MOVCL,4XCHGAH,ALAGAIN:MOVDL,0FHANDDL,ALADDDL,30HDECDIMOV[DI],DLSHRAX,CLANDAX,AXJNZAGAINPOPFJNCOPUTDECD
5、IMOVBYTEPTR[DI],1OPUT:MOVDX,DIMOVAH,9INT21H3-8编写程序,将字节变量BVAR中的二进制数(0~FFH)转换为BCD数,在屏幕上以十进制数形式显示结果。BVARDB99HOBUFDB4DUP(0)MOVAL,BVARMOVAH,0MOVDL,100DIVDLADDAL,30HMOVOBUF,ALMOVAL,AHAAMADDAX,3030HMOVOBUF+1,AHMOVOBUF+2,ALMOVOBUF+3,$MOVDX,OFFSETOBUFMOVAH,9INT21H3-30源程序如下,阅读后做如下试题:1.在分号后给指令或(向下)给程序
6、段加上注释(实质是做什么?例如,第1个注释若注为将2送BX,则视为非实质注释,不给分)。2.列举实例,说明该程序的功能(键入什么?显示什么?)。3.画出实例的数据存储图。IBUFDB255,0,255DUP(0)ABCDDB0AH,ABCD:DB255DUP(0)MNOPDB0AH,0DH,MNOP:DB255DUP(0)MOVDX,OFFSETIBUFMOVAH,10INT21HMOVBX,2;MOVSI,OFFSETABCD+7MOVDI,OFFSETMNOPQ+8AG:CMPIBUF[BX-1],0DH;JEEXITCMPIBUF[BX],'-';JNEP1CALLMP
7、JMPAGP1:XCHGSI,DI;CALLMPXCHGSI,DIJMPAGEXIT:MOVBYTEPTR[SI-1],'$'MOVBYTEPTR[DI-1],'$'MOVAH,9MOVDX,OFFSETABCDINT21HMOVDX,OFFSETMNOPQINT21HMPPROC;MOVAL,IBUF[BX]MOV[DI],ALINCDIINCBXCMPIBUF[BX-1],0DHJEBACKCMPIBUF[BX-1],','JNEMPBACK:RETM