|
发表于 2014-9-17 10:28:43
|
显示全部楼层
检测点3.1
(1) 在DEBUG中,用 "D 0:0 lf" 查看内存,结果如下:
0000:0000 70 80 F0 30 EF 60 30 E2-00 80 80 12 66 20 22 60
0000:0010 62 26 E6 D6 CC 2E 3C 3B-AB BA 00 00 26 06 66 88
下面的程序执行前,AX=0,BX=0,写出每条汇编指令执行完后相关寄存器中的值
mov ax,1
mov ds,ax
mov ax,[0000] ax= 2662H
mov bx,[0001] bx= E626H
mov ax,bx ax= E626H
mov ax,[0000] ax= 2662H
mov bx,[0002] bx= D6E6H
add ax,bx ax= FD48H
add ax,[0004] ax= 2C14H
mov ax,0 ax= 0
mov al,[0002] ax= 00e6H
mov bx,0 bx= 0
mov bl,[000c] bx= 0026H
add al,bl ax= 000CH
用DEBUG进行验证:
Microsoft(R) Windows DOS
(C)Copyright Microsoft Corp 1990-2001.
C:\DOCUME~1\000>debug
-e 0000:0
0000:0000 68.70 10.80 A7.f0 00.30 8B.ef 01.60 70.30 00.e2
0000:0008 16.00 00.80 AF.80 03.12 8B.66 01.20 70.22 00.60
0000:0010 8B.62 01.26 70.e6 00.d6 B9.cc 06.2e 14.3c 02.3b
0000:0018 40.ab 07.ba 14.00 02.00 FF.26 03.06 14.66 02.88
-d 0000:0 1f
0000:0000 70 80 F0 30 EF 60 30 E2-00 80 80 12 66 20 22 60 p..0.`0.....f "`
0000:0010 62 26 E6 D6 CC 2E 3C 3B-AB BA 00 00 26 06 66 88 b&....<;....&.f.
-a
0DB4:0100 mov ax,1
0DB4:0103 mov ds,ax
0DB4:0105 mov ax,[0000]
0DB4:0108 mov bx,[0001]
0DB4:010C mov ax,bx
0DB4:010E mov ax,[0000]
0DB4:0111 mov bx,[0002]
0DB4:0115 add ax,bx
0DB4:0117 add ax,[0004]
0DB4:011B mov ax,0
0DB4:011E mov al,[0002]
0DB4:0121 mov bx,0
0DB4:0124 mov bl,[000c]
0DB4:0128 add al,bl
0DB4:012A
-r
AX=0000 BX=0000 CX=0000 DX=0000 SP=FFEE BP=0000 SI=0000 DI=0000
DS=0DB4 ES=0DB4 SS=0DB4 CS=0DB4 IP=0100 NV UP EI PL NZ NA PO NC
0DB4:0100 B80100 MOV AX,0001
-t
AX=0001 BX=0000 CX=0000 DX=0000 SP=FFEE BP=0000 SI=0000 DI=0000
DS=0DB4 ES=0DB4 SS=0DB4 CS=0DB4 IP=0103 NV UP EI PL NZ NA PO NC
0DB4:0103 8ED8 MOV DS,AX
-t
AX=0001 BX=0000 CX=0000 DX=0000 SP=FFEE BP=0000 SI=0000 DI=0000
DS=0001 ES=0DB4 SS=0DB4 CS=0DB4 IP=0105 NV UP EI PL NZ NA PO NC
0DB4:0105 A10000 MOV AX,[0000] DS:0000=2662
-t
AX=2662 BX=0000 CX=0000 DX=0000 SP=FFEE BP=0000 SI=0000 DI=0000
DS=0001 ES=0DB4 SS=0DB4 CS=0DB4 IP=0108 NV UP EI PL NZ NA PO NC
0DB4:0108 8B1E0100 MOV BX,[0001] DS:0001=E626
-t
AX=2662 BX=E626 CX=0000 DX=0000 SP=FFEE BP=0000 SI=0000 DI=0000
DS=0001 ES=0DB4 SS=0DB4 CS=0DB4 IP=010C NV UP EI PL NZ NA PO NC
0DB4:010C 89D8 MOV AX,BX
-t
AX=E626 BX=E626 CX=0000 DX=0000 SP=FFEE BP=0000 SI=0000 DI=0000
DS=0001 ES=0DB4 SS=0DB4 CS=0DB4 IP=010E NV UP EI PL NZ NA PO NC
0DB4:010E A10000 MOV AX,[0000] DS:0000=2662
-t
AX=2662 BX=E626 CX=0000 DX=0000 SP=FFEE BP=0000 SI=0000 DI=0000
DS=0001 ES=0DB4 SS=0DB4 CS=0DB4 IP=0111 NV UP EI PL NZ NA PO NC
0DB4:0111 8B1E0200 MOV BX,[0002] DS:0002=D6E6
-t
AX=2662 BX=D6E6 CX=0000 DX=0000 SP=FFEE BP=0000 SI=0000 DI=0000
DS=0001 ES=0DB4 SS=0DB4 CS=0DB4 IP=0115 NV UP EI PL NZ NA PO NC
0DB4:0115 01D8 ADD AX,BX
-t
AX=FD48 BX=D6E6 CX=0000 DX=0000 SP=FFEE BP=0000 SI=0000 DI=0000
DS=0001 ES=0DB4 SS=0DB4 CS=0DB4 IP=0117 NV UP EI NG NZ NA PE NC
0DB4:0117 03060400 ADD AX,[0004] DS:0004=2ECC
-t
AX=2C14 BX=D6E6 CX=0000 DX=0000 SP=FFEE BP=0000 SI=0000 DI=0000
DS=0001 ES=0DB4 SS=0DB4 CS=0DB4 IP=011B NV UP EI PL NZ AC PE CY
0DB4:011B B80000 MOV AX,0000
-t
AX=0000 BX=D6E6 CX=0000 DX=0000 SP=FFEE BP=0000 SI=0000 DI=0000
DS=0001 ES=0DB4 SS=0DB4 CS=0DB4 IP=011E NV UP EI PL NZ AC PE CY
0DB4:011E A00200 MOV AL,[0002] DS:0002=E6
-t
AX=00E6 BX=D6E6 CX=0000 DX=0000 SP=FFEE BP=0000 SI=0000 DI=0000
DS=0001 ES=0DB4 SS=0DB4 CS=0DB4 IP=0121 NV UP EI PL NZ AC PE CY
0DB4:0121 BB0000 MOV BX,0000
-t
AX=00E6 BX=0000 CX=0000 DX=0000 SP=FFEE BP=0000 SI=0000 DI=0000
DS=0001 ES=0DB4 SS=0DB4 CS=0DB4 IP=0124 NV UP EI PL NZ AC PE CY
0DB4:0124 8A1E0C00 MOV BL,[000C] DS:000C=26
-t
AX=00E6 BX=0026 CX=0000 DX=0000 SP=FFEE BP=0000 SI=0000 DI=0000
DS=0001 ES=0DB4 SS=0DB4 CS=0DB4 IP=0128 NV UP EI PL NZ AC PE CY
0DB4:0128 00D8 ADD AL,BL
-t
AX=000C BX=0026 CX=0000 DX=0000 SP=FFEE BP=0000 SI=0000 DI=0000
DS=0001 ES=0DB4 SS=0DB4 CS=0DB4 IP=012A NV UP EI PL NZ NA PE CY
0DB4:012A C6061799FF MOV BYTE PTR [9917],FF DS:9917=9A
-q
检测点3.1
(2) 内存中的情况如图3.6所示
各寄存器的初始值:cs=2000h,ip=0,ds=1000h,ax=0,bx=0;
① 写出CPU执行的指令序列(用汇编指令写出)。
② 写出CPU执行每条指令后,CS、IP和相关寄存器的数值。
③ 再次体会:数据和程序有区别吗?如何确定内存中的信息哪些是数据,哪些是程序?
图3.6内存情况示意
指令序列 CS IP DS AX BX
初始值 2000h 0 0 0 0
1 mov ax,6622h 2000h 3h 0 6622h 0
2 jmp 0ff0:0100 ff0h 100h 0 6622h 0
3 mov ax,2000h ff0h 103h 0 2000h 0
4 mov ds,ax ff0h 105h 2000h 2000h 0
5 mov ax,[8] ff0h 108h 2000h c389h 0
6 mov ax,[2] ff0h 10bh 2000h ea66h 0
|
|