This afternoon when using dbox learn assembly language, surprised to find that if the first operation of the data stack and then the data pop operations, the original location of the data stack address changes randomly
running the experiment 5 (2) program, procedure is as follows
assume cs:code,ds:data,ss:stack
data segment
dw 0123h,0456h,0789h,0abch,0defh,0fedh,0cbah,0987h
data ends;076a:0000中存放这些数
stack segment
dw 0,0,0,0,0,0,0,0
stack ends;076a:0010中存放这些数
code segment
start: mov ax,stack
mov ss,ax;ss=076B
mov sp,16;sp=10h
mov ax,data
mov ds,ax;ds=076A
push ds:[0];将076A:0000中的数压入栈中
;076A:000E中开始存放数据,即0123h
push ds:[2];将076A:0002中的数压入栈中
;076A:000C中开始存放数据,即0456h
pop ds:[2];将栈中的数弹出076A:0002
;即0123h放入076A:0002
pop ds:[0];将栈中的数弹出076A:0000
;即0456h放入076A:0000
mov ax,4c00h
int 21h
code ends
end start
As can be seen, the data of the original stack 0456, data corresponding to the position after the stack will change
Data (3) in the run
after the original stack position after the change data is popped assembly language, such that after the original 5604 popped A3 01 becomes data corresponding to the data, and then playing a stack
data corresponding position It took place in a corresponding change