当前位置:
文档之家› 第3章 8086指令系统习题解答
第3章 8086指令系统习题解答
3.4
阅读下列各小题的指令序列,在后面空格中填入 该指令序列的执行结果。 (1) MOV BL,85H MOV AL,17H ADD AL,BL DAA AL=____, BL=____, CF=____ 解:17H+85H=9CHAL DAA 压缩的BCD码加法十进制调整指令。 (AL的低4位>9或AF=1,ALAL+06H,AF1; AF是辅助进位标志用以标志D3向D4的进位 AL的高4位>9或CF=1,ALAL+60H,CF1;) AL=9CH+ 06H=0A2H AL=0A2H+60H=02H, BL=85H CF=1
(4) MOV AX,0150H[BP] AX=____ 解:EA= BP+0150H=1350H PA=SS*16+EA=20000H+1350H=21350H AX=5188H
(5)POP AX ; AX=____,SP=____ 解:EA= SP=1350H PA=SS*16+EA=20000H+1350H=21350H AX=5188H, SP=1350H+2H=1352H (6)ADD[SI],CX (11354H)=____,(11355H)=____,SF=____ ZF=____, PF=____, CF=____, OF=____ 解:EA=SI=1354H, PA=DS*16+EA=10000H+1354H=11354H CX=339AH, (11354H)=52H,(11355H)=OE7H 0E752H+339AH=11AECH->(11355H): (11354H) (11354H) =0ECH, (11355H)= 1AH
(10)SAR BYTE PTR 0150H[BX],1 (11350H) =____, CF=____, OF=____ 解:EA=BX+0150H=1350H PA=DS*16+EA=11350H, (11350H)=0A5H= 10100101B 11010010B=0D2H, CF=1,OF=0 (当移位数为1是,最高位不变则OF=0) (11)SAL BYTE PTR 0150H[BX],1 (11350H)=____,CF=____,OF=____ 解:EA=BX+0150H=1350H,PA=DS*16+EA=11350, (11350H)=0A5H= 10100101B 01001010B=4AH, CF=1,OF=1
(2) MOV AX,BX;NOT AX; ADD AX,BX; lNC AX AX=____,CF=____ 解:lNC不影响标志位 AX=0000H, CF=0 (3)MOV AX,0FF60H ; STC ; MOV DX,96 XOR DH,0FFH ; SBB AX DX AX=____,CF=____ 解:XOR 命令 会使 CF0,OF0 96=60H,AX=0000H, CF=0 (4)MOV BX,0FFFEH ; MOV CL,2;SAR BX,CL BX=____,CF=____ 解:0FFFEH=1111111111111110B 1111111111111111B,CF=0 1111 1111 1111 1111B,CF=1
SI=(09226H)=00F6H, DS=(09228H)=1E40H EA= SI=00F6H, PA=DS*16+EA=1E400H+00F6H=1E4F6H (1E4F6H)= BX=0024H
(5)
XCHG CX,[BX+32H] XCHG[BX+20H][SI],AX
解:EA= BX+32H=56H, PA=DS*16+EA=91D0H+56H =9226H (09226H)= CX=5678H , CX=(09226H)=00F6H EA= BX+20H+SI=56H,PA=DS*16+EA=91D0H+56H =9226H AX=(09226H)=5678H ,(09226H) =
(3)LEA BX,[BX+20H][SI] MOV AX,[BX+2] 解:BX= BX+20H+ SI=0056H EA= BX+2=58H PA=DS*16+EA=91D0H+58H=9228H AX=(09228H)=1E40H
(4) LDS SI,[BX][DI] MOV[SI],BX 解:EA= BX+DI=56H, PA=DS*16+EA=91D0H+56H =9226H
(1)MOV CL,[BX+20H][SI] 解:EA= BX+20H+SI=56H PA=DS*16+EA=91D0H+56H=9226H CL=(09226H)=F6H (2)MOV[BP][DI],CX 解: EA= BP+DI=56H PA=SS*16+EA=1E4F6H (1E4F6H)= 5678H
3.7完成下列操作,选用什么指令: (1)将AX的内容减去0520H,和上次运算的借位; SBB AX,0520H (2)将变量名TABL的段地址送AX。 MOV AX SEG TABL 3.8 D1 DB 20H DUP(?) D2 DW D1 请写出用一条指令实现取D1的偏移地址 SI中的三种方法。 (A) LEA SI,D1 (B) MOV SI,OFFSET D1 (C) MOV SI,D2
(3)AX=42C8H,BX=608DH 解:ADD AX,BX CF=0 ,OF=1, AX=0AC55H SUB AX,BX;CF=0,OF=0;L3 (4) AX=0D023H,BX=9FDOH 解:ADD AX,BX OF=1,CF=1,AX=6FF3H SUB AX,BX ;CF=1,OF=1;L5 (5)AX=9FDOH,BX=0D023H 解:ADD AX,BX OF=1,CF=1,AX=6FF3H SUB AX,BX ;CF=1,OF=1;L5
3.9 程序段1 程序段2 MOV AX , 147BH MOV AX , 99D8H MOV BX , 80DCH MOV BX , 9847H ADD AX , BX SUB AX , BX JNO L1 JNC L3 JNC L2 JNO L4 上述两个程序段执行后,分别转移到哪里? 解:1) L1 2) L3
(1)当AL =00H时, 3.6 AND AL,AL 程序转向BRCHl JZ BRCHl RCR AL,1 (2)当AL =01H时, JZ BRCH2 程序转向BRCH2 RCL AL,1 INC AL (3)当AL =0FFH时, JZ BRCH3 程序转向BRCH3 上述程序运行后,试回答:
(11354H) =0ECH, (11355H)= 1AH CF=1,ZF=0, PF(低八位奇偶校验):0ECH= 11101100BPF=0 SF(最高位状态),1H=0001BSF=0 OF(溢出标志) 0E752H=1110011101010010B 339AH=11001110011010B 1110011101010010 + 11001110011010 10001101011101100
第三章习题讲评
3.1 已知DS=091DH,SS=1E4AH,AX=1234H,BX=0024H,CX=5678H,BP=0024H SI=0012H,DI=0032H,(09226H)=00F6H,(09228H)=1E40H,(1E4F6H)=091DH。 在以上给出的环境下,试问下列指令或指令段执行后的结果如何?
• 3、3 设下列各转移指令的第一字节在内存中的地址为 CS=2000H和IP=016EH,且环境均为DS=6000H, BX=16C0H,(616C0H)=46H,(616C1H)=01H, (616C2H)=00H,(616C3H)=30H,(61732H) =70H,(61733H)=17H。写出下列各无条件转移指令 执行后CS和IP值。个指令左首的16进制编码是该指令的机 器码。指令中的目的地址用相应的标号表示。 (1)EBE7 JMP SHOURT AGAIN (2)E90016 JMP NEARPTR OTHER (3)E3 JMP BX (4)EA46010010 JMP FAR PROB (5)FF67 JMP WORD PTR 0072H[BX] (6)FFEB JMP DWORD PTR [BX]
AX=1234H
3.2设DS=1000H,SS=2000H,AX=1A2BH,BX=1200H,CX=339AH,BP=1200H,SP=1350H, SI=1354H,(11350H)=0A5H,(11351H)=3CH,(11352H)=0FFH,(11353H)=26H, (11354H)=52H,(11355H)=OE7H,(126A4H)=9DH,(126A5H)=16H,(21350H)=88H, (21351H)=51H 下列各指令都在此环境下执行,在下列各小题的空格中填入相应各指令的执行结果。
(7)SUB BH,0150H[BX][SI] BH=____,SF=____,ZF=____,PF=____,CF=____,0F=____ 解:EA=0150H+BX+SI=26A4H; PA=DS*16+EA=10000H+26A4H=126A4H; (126A4H)=9DH,BH=12H BH=75H, SF=0,ZF=0,PF=0, CF=1 ,OF=0 (8)INC BYTE PTR 0152H[BX] (11352H)=____,(11353H)=____,CF=____ 解:EA=0152H+ BX= 1352H,PA=DS*16+EA=11352, (11352H)=0FFH, (11352H)=00H, (11353H)= 26H, 不影响CF (9)INC WORD PTR 0152H[BX] (11352H)=____,(11353H)=____,CF=____ 解:EA=0152H+ BX= 1352H, PA=DS*16+EA=11532, (11352H)=0FFH, (11353H)= 26H (11352H)=00H, (11353H)= 27H, 不影响CF