assume cs:codesg
codesg segment
dw 0123h,0456h,0789h,0abch,0defh,0fedh,0cbah,0987h
dw 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
;用dw定义16个字型数据,在程序加载后,将取得16个字的内存空间
;存放这16个数据。在后面的程序中将这段空间当作栈空间来使用
start : mov ax,cs
mov ss,ax
mov sp,30h ;将设置栈顶ss:sp指向cs:30 ??? 为什么是30H?
mov bx,0
mov cx,8
s : push cs:[bx]
add bx,2
loop s
mov bx,0
mov cs,8
s0 : pop cs:[bx]
add bx,2
loop s0
mov ax,4c00h
int 21h
codesg ends
end start
根据end start这句 可以得出 (cs) = (start)
第一句mov ax,cs 得出:(ax) = (cs) = (start)
第二句mov ss,ax 得出:(ss) = (ax) = (cs) = (start)
第三句mov sp,30h 这里就有问题了,根据程序结构, 程序所占内存应该是这样:PSP + dw + start才对,但栈寄存器ss却指定的是start的段地址,并且sp指定了不知所以的30h 到底什么意思? |