您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 信息化管理 > 汇编语言(沈美明,温冬婵)课后答案
汇编语言程序设计(第二版)(清华大学IBM-PC汇编语言程序设计(第二版)沈美明温冬婵编著)第二章1、答:直接由指令指定的I/O端口数为256个。2、答:3、答:字节单元:(30022H)=ABH,(30024H)=EFH字单元:(30021H)=AB34H,(30022H)=CDABH。4、答:3017:000A的存储单元的物理地址是3017AH,3015:002A的存储单元的物理地址是3017AH,3010:007A的存储单元的物理地址是3017AH。5、答:该程序的第一个字的物理地址是0AAA40H。6、答:条件标志OF、SF、ZF、CF的值依次分别为0、0、0、0。7、答:(1)AX、BX、CX、DX、AH、AL、BH、BL、CH、CL、DH、DL、SP、BP、DI、SI(注意:学生尽量不要用SP参与加减运算)(2)CX(3)DX、AX、AH、AL(4)CS、DS、ES、SS(5)FLAGS(6)IP(7)SS、SP、BP8、答:可以用来指示存储器地址的寄存器有BX、SP、BP、DI、SI、IP、CS、DS、ES、SS。9、答:唯一正确的是D。第三章2、答:(1)ADDDX,BX(2)ADDAL,[BX][SI](3)ADD[BX+0B2H],CX(4)ADD[0524H],2A59H(5)ADDAL,0B5H3、答:(1)MOVBX,OFFSETBLOCK+0AHMOVDX,[BX](2)MOVBX,0AHMOVDX,BLOCK[BX](3)MOVBX,OFFSETBLOCKMOVSI,0AHMOVDX,[BX][SI]4、答:(1)1200H(2)0100H(3)4C2AH(4)3412H(5)4C2AH(6)7856H(7)65B7H6、答:MOVBX,2000HLESDI,[BX]MOVAX,ES:[DI]7、答:(1)064DH(2)0691H(3)05ECH9、答:(1)MOVAX,[BX+0CH]MOVZERO,AX(2)MOVAX,ARRAY[BX]MOVZERO,AX10、答:(1)(AX)=1234H(2)(AX)=0032H11、答:(AX)=1E00H12、答:LEABX,CSTRINGMOVDL,[BX]MOVDH,[BX+6]13、答:14、答:LESBX,[2000]MOVAX,ES:[BX]16、答:(1)74D4HSF=0ZF=0CF=0OF=0(2)A5C1HSF=1ZF=0CF=0OF=1(3)3240HSF=0ZF=0CF=1OF=0(4)0000HSF=0ZF=1CF=1OF=017、答:(1)0C754HSF=1ZF=0CF=1OF=0(2)12B0HSF=0ZF=0CF=0OF=0(3)45B0HSF=0ZF=0CF=0OF=1(4)9F24HSF=1ZF=0CF=0OF=021、答:(1)MOVAX,ZSUBAX,XADDAX,WMOVZ,AX(2)MOVBX,XADDBX,6MOVCX,RADDCX,9MOVAX,WSUBAX,BXSUBAX,CXMOVZ,AX(3)MOVAX,WIMULXMOVBX,YADDBX,6IDIVBXMOVZ,AXMOVR,DX22、答:NEGDXNEGAXSBBDX,016、答:MOVAX,AMOVDX,A+2TESTDX,8000HJZSTORE;为正NEGDXNEGAXSBBDX,0STORE:MOVB,AXMOVB+2,DX17、答:(1)MOVAL,SSUBAL,6DASADDAL,VDAAMOVU,AL(2)MOVAL,ZSUBAL,UDASMOVU,ALMOVAL,XADDAL,WDAASUBAL,UDASMOVU,AL23、答:(1)(BX)=9AH(2)(BX)=61H(3)(BX)=0FBH(4)(BX)=1CH(5)(BX)=0(6)(BX)=0E3H26、答:把(DX)(AX)中的双字左移四位(乘以16)。20、答:MOVCL,4SHRAX,CLMOVBL,DLSHRDX,CLSHLBL,CLORAH,BL31、答:(1)CLDMOVCX,132MOVAL,20HLEADI,ARRAYREPSTOSB(2)CLDMOVCX,9MOVAL,‘*’LEADI,ADDRREPNESCASBJNEL1L2:……;找到L1:……;未找到(3)CLDMOVCX,30MOVAL,20HLEADI,NAMEREPESCASBJNEDO_NOTMOVCX,30MOVAL,‘$’LEADI,NAMEREPSTOSB…DO_NOT:…(4)CLDMOVCX,30LEASI,NAMELEADI,ARRAYREPMOVSBSTDMOVCX,9LEASI,ADDR+8LEADI,ARRAY+131REPMOVSB34、答:(1)转L1(2)转L1(3)转L2(4)转L5(5)转L536、答:2p£q时,(AX)22pq时,(AX)138、答:(1)(AX)=5(BX)=16(CX)=0(DX)=0(2)(AX)=2(BX)=4(CX)=3(DX)=1(3)(AX)=3(BX)=7(CX)=2(DX)=039、答:第四章1、答:(2)源*作数和目的*作数同为存储器寻址方式。(3)SI、DI同为变址寄存器。(7)目的*作数不能是代码段段寄存器CS。(5)缺少PTR5、答:BYTE_VAR425954450CEE00??-01020102??00??01020102??00??0102-0102??WORD_VAR0000010002000000-01000200000001000200000001000200-000001000200????FBFF594245545602-8、答:PLENTH的值为22(16H)。12、答:(1)10025(2)25(3)2548(4)3(5)103(6)0FFFFH(7)1(8)35假设数据段中数据定义如下:VARDW'34'VAR1DB100,'ABCD'VAR2DD1COUNTEQU$-VAR1XDW5DUP(COUNTDUP(0))YLABELWORDZDB'123456'VDW2,$-VAR执行下面程序段并回答问题。MOVAX,COUNT;(AX)=?MOVBX,Z-X;(BX)=?MOVCX,V+2;(CX)=?MOVDX,VAR;(DX)=?MOVY+3,2MOVSI,Y+4;(SI)=?ADDZ+5,1MOVDI,WORDPTRZ+4;(DI)=?、答:(AX)=9(BX)=90(CX)=109(DX)=3334H(SI)=3600H(DI)=3700H14、答:(1)(AX)=1(2)(AX)=2(3)(CX)=20(4)(DX)=40(5)(CX)=117、答:D_SEGSEGMENTD_WORDLABELWORDAUGENDDD99251S_WORDLABELWORDSUMDD?D_SEGENDSE_SEGSEGMENTE_WORDLABELWORDADDENDDD-15962E_SEGENDSC_SEGSEGMENTASSUMECS:C_SEG,DS:D_SEG,ES:E_SEGMAINPROCFARSTART:PUSHDSMOVAX,0PUSHAXMOVAX,D_SEGMOVDS,AXMOVAX,E_SEGMOVES,AXMOVAX,D_WORDMOVBX,D_WORD+2ADDAX,ES:E_WORDADCBX,ES:E_WORD+2MOVS_WORD,AXMOVS_WORD+2,BXRETMAINENDPC_SEGENDSENDSTART16、答:DATASGSEGMENTAT0E000HWORD_ARRAYLABELWORDBYTE_ARRAYDB100DUP(?)DATASGENDSSTACKSGSEGMENTPARASTACK'STACK'DW32DUP(?)TOSLABELWORDSTACKSGENDSCODESGSEGMENTORG1000HMAINPROCFARASSUMECS:CODESG,DS:DATASG,ES:DATASG,SS:STACKSGSTART:MOVAX,STACKSGMOVSS,AXMOVSP,OFFSETTOSPUSHDSSUBAX,AXPUSHAXMOVAX,DATASGMOVDS,AXMOVES,AX……RETMAINENDPCODESGENDSENDSTART9编写一个完整的程序,要求把含有23H,24H,25H,26H四个字符数据的数据区复制20次。、答:DSEGSEGMENTVAR1DB23H,24H,25H,26HDSEGENDSESEGSEGMENTVAR2DB80DUP('?')ESEGENDSCSEGSEGMENTASSUMECS:CSEG,DS:DSEG,ES:ESEGMAINPROCFARSTART:PUSHDSMOVAX,0PUSHAXMOVAX,DSEGMOVDS,AXMOVAX,ESEGMOVES,AXMOVDX,20CLDLEADI,VAR2AGAIN:LEASI,VAR1MOVCX,4REPMOVSBDECDXJNZAGAINRETMAINENDPCSEGENDSENDSTART第五章1、答:……movcx,countleasi,string1leadi,string2again:moval,[si]mov[di],alincsiincdiloopagain2、答:codesegmentassumecs:codemainprocfarstart:pushdsmovax,0pushaxmovah,1int21hsubal,30hcmpal,0jzexitmovcl,almovch,0again:movah,2movdl,7int21hloopagainexit:retmainendpcodeendsendstart……8、答:MOVCX,8MOVDL,0NEXT3:RORAX,1JNCNEXT1RORAX,1JNCNEXT2INCDLNEXT2:LOOPNEXT3ADDDL,30HMOVAH,2INT21HMOVAH,4CHINT21HNEXT1:RORAX,1JMPNEXT212、答:……movcx,100leadi,memmovax,0cldcomp:repnescaswjcxzexitpushcxmovsi,disubdi,2movbx,direpmovswmovwordptr[di],0movdi,bxpopcxjmpcompexit:……13、答:……movdx,100movsi,0repeat:moval,string[si]cmpal,30hjbgooncmpal,39hjagoonorcl,20h;(cl)51jmpexitgoon:incsidecdxjnzrepeatandcl,0dfh;(cl)50exit:……14、答:……tabledw100hdup(?)mdatadw?;存放出现次数最多的数countdw0;存放出现次数……movbx,100hmovdi,0;di为数组TABLE的指针next:movdx,0movsi,0movax,table[di]movcx,100hcomp:cmptable[si],axjneaddrincdxaddr:addsi,2loopcompcmpdx,countjlechangmovcount,dxmovmdata,axchang:adddi,2decbxjnznextmovcx,countmovax,mdata……19、答:……adw15dup(?)bdw20dup(?)cdw15dup(?)……movsi,0;si为数组A的指针movbx,0;bx为数组C的指针movcx,15loop1:movdi,0;di为数组B的指针pushcxmovcx,20movax,a[si]loop2:cmpb[di],axjnenomovc[bx],axaddbx,2jmpnextno:adddi,2looploop2next:addsi,2popcx
本文标题:汇编语言(沈美明,温冬婵)课后答案
链接地址:https://www.777doc.com/doc-3973816 .html