您好,欢迎访问三七文档
当前位置:首页 > 临时分类 > 汇编语言课后习题答案---郑晓薇(整理后的)
习题一1无符号数:11010011=211=D3H,01110111=119=77H,10000011=131=83H,00101111=47=2FH,10101010=170=AAH带符号数:11010011=-45=D3H,01110111=+119=77H,10000011=-125=83H,00101111=+47=2FH,10101010=-86=AAH25E8AH,0BE6H,3DEH,4940H300011101+00110101=01010010=52H=8201001001+11101000=00110001=31H=4910111110+01010010=00010000=10H=1610011010+11110001=10001011=8BH=-117400101001+01010011=01111100+00000110=10000010=82H=8201110011-00100100=01001111-00000110=01001001=49H=4901100110+00011000=01111110+00000110=10000100=84H=840000000100110010+01110101=0000000110100111+00000110=0000001000000111=0207H=2075000020A3H,FF94H,00003456H,007FH,FFFFEC00H6无符号数:0~65535,0000H~FFFFH;带符号数:-32768~+32767,8000H~7FFFH7(1)38H等于十进制数56,是十进制数56的补码,数字8的ASCII码,十进制数38的压缩BCD码(2)FFH等于十进制数-1,是带符号数-1的补码,无符号数为255(3)5AH等于十进制数90,是十进制数90的补码,大写字母Z的ASCII码(4)0DH等于十进制数13,是十进制数13的补码,回车符的ASCII码8(1)108=01101100B=6CH,补码01101100B,压缩BCD码0000000100001000,ASCII码313038H(2)46=00101110B=2EH,补码00101110B,压缩BCD码01000110,ASCII码3436H(3)–15=11110001B=F1H,补码11110001B,ASCII码2D3135H(4)254=0000000011111110B=00FEH,补码0000000011111110B,压缩BCD码0000001001010100,ASCII码323534H9(1)56+63=01110111B,CF=0,SF=0,ZF=0,OF=0(2)83-45=00100110B,CF=0,SF=0,ZF=0,OF=0(3)-74+29=11010011B,CF=0,SF=1,ZF=0,OF=0(4)-92-37=01111111B,CF=1,SF=0,ZF=0,OF=110回车、换行、响铃、ESC键、空格键、@、P、p习题二9最少划分为16个逻辑段,最多划分为65536个逻辑段(每段16个字节)10CS:IP,DS:BX、SI、DI,ES:BX、SI、DI,SS:SP、BP11字节单元保存8位数,字单元保存16位数。根据源操作数的属性确定要访问的是字节单元还是字单元。12对于字节单元来说,偶地址和奇地址一样;对于字单元而言,最好用偶地址保存,可减少CPU的访存次数。13首单元的物理地址=38AE8H,末单元的物理地址=38AE8H+7FFFH=40AE7H16(1)物理地址=27679H(2)物理地址=20F92H(3)物理地址=20F92H(2)和(3)的物理地址是一样的。说明逻辑地址不唯一,多个逻辑地址可对应到同一个物理单元上。17代码段CS:IP的物理地址=55A84H堆栈段SS:SP的物理地址=4DB65H数据段DS:BX的物理地址=17678H附加段ES:DI的物理地址=2BA41H18当前栈指针所指单元的物理地址是1522CH。堆栈区中还能保存254个字。19执行E20020执行U10021执行RCX,然后输入10022执行EDS:0‘a’‘b’‘c’‘d’习题三3MOVAX,BX源操作数为寄存器寻址,EA无,物理地址无MOVAX,1290H立即寻址,EA无,物理地址无MOVAX,[BX]寄存器间接寻址,EA=1290H,物理地址=2FBB0HMOVAX,DS:[1290H]直接寻址,EA=1290H,物理地址=2FBB0HMOVAX,[BP]寄存器间接寻址,EA=6756H,物理地址=26A56HMOV[DI][BX],AX目的操作数为基址变址寻址,EA=3C06H,物理地址=32526HMOVES:[SI],AX寄存器间接寻址,EA=348AH,物理地址=50CAAH7MOVAX,[CX]错。CX不能为间址寄存器MOVAL,1200H错。立即数超出8位寄存器范围MOVAL,BX错。两个操作数不匹配MOV[SI][DI],AX错。两个变址寄存器不能在一起MOVES:[DX],CX错。DX不能为间址寄存器MOV[AX],VALUE错。AX不能为间址寄存器MOVCOUNT,[SI]错。两个操作数不能都是存储单元8(1)MOVAX,BX(2)MOVCL,15(3)ADDAX,[BX](4)MOV[BX+SI],AL(5)MOVAX,VALUE[SI](6)SUBAX,DS:[2000H]9(1)ADDAX,[X+4]MOVY,AX(2)MOVBX,4ADDAX,X[BX]MOVY,AX(3)MOVBX,4MOVSI,OFFSETXADDAX,[BX+SI]MOVY,AX10立即寻址方式中操作数(立即数)和指令一起存放在代码段中。习题四10(1)DATASEGMENTXDW0YDW0DATAENDS(2)STRINGDB’Computer’(3)COUNTDB100DUP(?)(4)PIEQU3.14(5)VALUELABELBYTE11(1)对。(2)错。260超出了字节范围。(3)错。X3是字节型,1234H是字型,不匹配。(4)对。(5)错。缺少DUP。(6)对。12(1)AL=3。(2)AX=2103H。(3)DX=TABLE的偏移地址。(4)CL=33H(5)BX=TABLE的段地址。(6)BX=1。(7)DX=TABLE的偏移地址。13MOVDX,2012HMOVAX,5D68HMOVCX,1003HMOVBX,49A6HADDAX,BX(SUBAX,BX)ADCDX,CX(SBBDX,CX)14SUBAX,CXSBBDX,015MOVAX,extraMOVES,AX16(1)MOVAL,16ADDAL,XMOVBL,5IMULBLMOVZ,AX(2)MOVBL,4MOVAL,XIDIVBLSUBAL,YMOVZ,AX(3)MOVAL,XMOVBL,8IMULBLMOVDX,AXMOVAH,0MOVAL,YMOVBL,16IDIVBLCBWADDDX,AXMOVAH,0MOVAL,WIMULALSUBDX,AXMOVZ,DX(4)MOVAL,XADDAL,YMOVBL,XSUBBL,YMOVAH,0IMULBLMOVZ,AXMOVAL,XIDIVYCBWSUBZ,AX17Z=(5+22-15)*14=16818从伪指令ENDSTART处获知程序从START标号开始。19(1)减法:(2)加法:MOVAX,8576HMOVAX,8576HMOVBX,9988HMOVBX,9988HSUBAX,BXADDAX,BX结果:AX=EBEEH结果:AX=1EFEHCF=1,OF=0,ZF=0,SF=1CF=1,OF=1,ZF=0,SF=021(1)MOVAL,56HMOVBL,34HADDAL,BLDAAMOVY1,AL(2)MOVAX,128HMOVBX,35HSUBAX,BXDASMOVY2,AL(3)MOVAL,68HMOVBL,23HADDAL,BLMOVBL,45HSUBAL,BLDASMOVY3,AL22(1)MOVAX,0708HMOVBX,0406HADDAL,BLADDAH,BH;不用带进位加AAA;加法调整,含进位调整MOVBX,AXXCHGAH,AL;高4位调整AAAMOVBH,ALMOVZ1,BX;保存十位、各位,百位在CF中(2)MOVAX,0905HMOVBX,0207HSUBAL,BLSUBAH,BH;不用带借位减AAS;减法调整MOVZ2,AX(3)MOVAX,0102HMOVBX,0006HMULBX;乘法先不用调整MOVBX,0303HSUBAX,BXAAS;减法调整MOVZ3,AX(4)MOVAX,0704HMOVBX,0108HADDAL,BLADDAH,BHAAA;加法调整MOVBL,6AAD;除法调整DIVBLMOVBH,AH;余数保存在BHANDAX,000FHAAA;商调整MOVZ4,AX;保存商23.modelsmall.databuffdb?.codestart:movax,@datamovds,axmovah,1;键盘输入int21hsubal,30h;去掉ASCII码movbuff,almovah,4chint21hendstart24.modelsmall.codestart:movah,1;键盘输入int21hsubal,20h;变为大写movdl,almovah,2int21hmovah,4chint21hendstart25.modelsmall.dataxdb12hydb34h.codestart:movax,@datamovds,axmoval,xaddal,y;结果为46Hmovah,al;AH=46Handal,0fh;AL=06Hmovcl,4rolah,cl;AH=64Handah,0fh;AH=04Haddax,3030h;AX=3436Hmovbx,axmovdl,bh;显示4movah,2int21hmovdl,bl;显示6int21hmovah,4chint21hendstart26datasegmentxdb'0.000','1.000','1.414','1.732','2.000'db'2.236','2.449','2.646','2.828','3.000';建立字符表ydb5dup(?);存放查到平方根udb3;要查的数dataendscodesegmentassumecs:code,ds:datastart:movax,datamovds,axmoval,u;要查的数movcl,5mulcl;u*5=15(号单元开始)movah,0movbx,ax;地址保存到bxmovsi,0let1:moval,x[bx];取出平方根数字movy[si],al;存入yincsiincbxlooplet1;循环取出5次movah,4chint21hcodeendsendstart27.modelsmall.datax1db'zhangyan$';姓名为10个字符宽度x2db'lili$'x3db'wanglan$'x4db'zhaoxue$'x5db'lijiang$'udb3;要查的学号.codestart:movax,@datamovds,axmoval,u;给出学号movcl,10mulcl;u*10=30(号单元开始)movah,0movdx,ax;地址保存到dxmovah,9;9号功能显示字符串int21hmovah,4chint21hendstart28编程实现公式计算Z=X/4+16Y。.modelsmall.dataxdb4ydb6zdb?.codestart:movax,@datamovds,axmoval,x;movcl,2saral,cl;X/4movcl,4movbl,ysalbl,cl;16Yaddal,bl;X/4+16Ymovz,almovah,4chint21hendstart29.modelsmall.dat
本文标题:汇编语言课后习题答案---郑晓薇(整理后的)
链接地址:https://www.777doc.com/doc-4737853 .html