ASM实验二(仿真简单指令)

 

请仿真以下简单指令及要求如下:
设DS=1000H,SS=2000H,AX=1A2BH,BX=1200H,
CX=339AH,BP=1200H,SP=1350H,SI=1354H,(11350H)=0A5H,(11351H)=3CH,(11352H)=OFFH,(11353H)=26H,(11354H)=52H,(11355H)=0E7H,(126A4H)=9DH,(126A5H)=16H,
(21350H)=88H,(21351H)=51H。


下列各指令都在此环境下执行,在下列各小题的空格中填入相应个指令的执行结果。
(1) MOV AX,1352H
AX=___ 1352H___
(2) MOV AX, [1352H]
AX=___ 26FFH___
(3) MOV 0150H [BX], CH
(11350H)=___33H__, (11351H)=___3CH___
(4) MOV AX, 0150H [BP]
AX=____5188H____
(5) POP AX
AX=___5188H___, SP=___1352H___
(6) ADD [SI], CX
(11354H)=__ECH__ , (11355H)=__1AH__,
SF=__0__, ZF=__0__, PF=__0__, CF=__1__
OF=__0___
(7) SUB BH, 0150H [BX][SI]
BH=_75H___, SF=__0__,ZF=__0__, PF=__0__, CF=__1__, OF=__0__
(8) INC BYTE PTR 0152H [BX]
(11352H)=___00H__,(11353H)=__26H___,CF=___0__
(9) INC WORD PTR 0150H [BX]
(11352H)=__FFH___,(11353H)=__26H___,CF=__0__
(10) SAR BYTE PTR 0150H [BX], 1
(11350H)=___D2H__,CF=___1__,OF=__0___
(11) SAL BYTE PTR 0150H [BX], 1
(11350H)=__4AH___,CF=__1___,OF=__1__

 

 

 代码:


MOV AX,1000H
MOV DS,AX;不能直接给DS,SS赋值,只能通过通用寄存器   
MOV AX,2000H
MOV SS,AX        
MOV AX,1A2BH
MOV BX,1200H
MOV CX,339AH
MOV BP,1200H
MOV SP,1350H 
MOV SI,1354H
MOV 0150H[BX],0A5H
MOV 0151H[BX],3CH
MOV 0152H[BX],0FFH 
MOV 0153H[BX],26H
MOV [SI],52H
MOV 1H[SI],0E7H
MOV [26A4H],9DH
MOV [26A5H],16H
MOV SS:[1350H],88H
MOV SS:[1351H],51H    

;在上面的环境下,以下一行行的运行
MOV AX,1352H        ;AX = 1352H
MOV AX, [1352H]      ;AX = 26FFH
MOV 0150H [BX], CH   ;[1350H]换为CX的高位CH,即33H   

;在基址加变址寻址方式中,若EBP,BP作基址寄存器,则默认段为SS,其他情况下,默认段为DS
MOV AX, 0150H[BP]    ;AX = 5188H  
POP AX                 ;
ADD [SI], CX            ;339AH+E752H = 11AECH , [1354H]=ECH [1355h]=1AH
SUB BH, 0150H [BX][SI]   ; 0150H [BX][SI] = 150H+1200H+1354H = 26A4H     12H - 9D = FFFFFFFFFFFFFF75(溢出?)
INC BYTE PTR 0152H [BX]   ;没进位,[1352H]=00H  [1353H]=26H
INC WORD PTR 0150H [BX]  
SAR BYTE PTR 0150H [BX], 1
SAL BYTE PTR 0150H [BX], 1  ;A5H = 10100101(2) 左移一位 = 01001010(2) = 4A

posted on 2009-03-18 16:28  fatkun  阅读(747)  评论(0编辑  收藏  举报

导航