汇编的多段合一问题 习题6.1
{:5_92:}今天看习题6.1的第二小题(2)
assume cs:codesg
codesg segment
dw 0123h,0456h,0789h,0abch,0defh,0fedh,0cbah,0987h
dw 0,0,0,0,0
start:
mov ax,cs ;cs为所填第一空
mov ss,ax
mov sp,1ah ;此条指令为所填第二空
mov ax,0
mov ds,ax
mov bx,0
mov cx,8
s:
push
pop cs: ;此条指令为所填第三空
add bx,2
loop s
mov ax,4c00h
int 21h
codesg ends
end start
问题是这样的 :
mov sp,1ah ;此条指令为所填第二空 mov ax,0
mov ds,ax 这为什么要把ds置零了? dw 0123h,0456h,0789h,0abch,0defh,0fedh,0cbah,0987h难道这个就是从0:0开始?不是应该把cs
mov bx,0 的值给ds才对吗?
mov cx,8
定义的数据段是从cs:0开始的,而你没看明白题目,题目要求用内存的0:0开始数据来替代cs:0开始的数据。前面当然是cs赋值给ss,后面ds当然依题意是0。 哈哈哈 谢谢哈还真是这么回事。。。真粗心的我。。。
页:
[1]