我的电脑是win7 32位的,cpu是i5 M430
(1)在题中我把代码中的数据段和堆栈段交换了位置
①0123H,0456H,0789H,0abcH,0defH,0fdeH,0cbaH,0987H
②cs=14cb;ss=14c9;ds=14ca;
③data段地址为:X-1;stack段地址为:X-2
(2)在题中我把代码中的数据段和堆栈段交换了位置
①0123H,0456H
②cs=14cb;ss=14c9;ds=14ca;
③data段地址为:X-1;stack段地址为:X-2
④N+x 个空间,其中(N+x)是16的倍数,x足够小以至于使他们可以被整除
(3)在题中我把代码中的数据段和堆栈段交换了位置
①0123H,0456H
②cs=14c9;ss=14cc;ds=14cd;
③data段地址为:X+4;stack段地址为:X+3
(4)第三题,伪指令“end start”是说明程序的可执行代码在内存中的开始位置,若将“start”去掉,cpu将不知道读入的数据哪些是数据,哪些是代码,这时cpu会将所有的数据都当成代码开始执行。那么第一、二题中数据会被当成代码,产出错误,不能正常执行。第三题中代码就在所有数据的首位置,所以会正常执行。
(5)该题书中给的c数据段的标识名在Masm6.11中编译通不过,故改为e,后来查资料得知,好像那个是关键字?!这里有疑问!!
;实验5 -- (5)
assume cs:code
a segment
db 1,2,3,4,5,6,7,8
a ends
b segment
db 1,2,3,4,5,6,7,8
b ends
e segment
db 0,0,0,0,0,0,0,0
e ends
code segment
start:
mov ax,a
mov ds,ax
mov dx,0
mov bx,0
mov cx,8
s:
mov ax,b
mov es,ax
mov dl,[bx]
add dl,es:[bx]
mov ax,e
mov es,ax
mov es:[bx],dl
inc bx
loop s
mov ax,4c00H
int 21H
code ends
end start
(6)
;实验5 -- (6)
assume cs:code
a segment
dw 1,2,3,4,5,6,7,8,9,0aH,0bH,0cH,0eH,0fH,0ffH
a ends
b segment
dw 0,0,0,0,0,0,0,0
b ends
code segment
start:
mov ax,b
mov ss,ax
mov sp,16 ;初始化堆栈寄存器
mov ax,a
mov ds,ax ;初始化数据段寄存器
mov bx,0
mov cx,8
s:
push [bx]
add bx,2
loop s
mov ax,4c00H
int 21H
code ends
end start
- [chinatree] 明白了就可以。 09/24 12:07
- [tomato] 你说的对啊,表达能力很重要。 09/04 19:56
- [游客] 加油! 08/06 13:27
- [tomato] 比较简单的一道程序题。 08/05 23:47
- [游客] 恩,我也回来了。 08/02 17:08
- [chinatree] 顶 07/31 14:42
- [qingpengchen2011] 嗯· 07/30 20:43