1、将下面程序保存为t1.asm文件,将其生成可执行文件t1.exe
assume cs:codesg
codesg segment
mov ax,2000H
mov ss,ax
mov sp,0
add sp,10
pop ax
pop bx
push ax
push bx
pop ax
pop bx
mov ax,4c00H
int 21H
link时出现warning:
image.png
未设栈段但是使用了栈
debug:每一步执行后寄存器和栈顶内容:
image.png
image.png
image.png
image.png
image.png
image.png
image.png
image.png
image.png
image.png
查看PSP头两个字节:
1、重新加载程序
image.png
可以看到程序起始段地址为075C,该段地址即为PSP的段地址
2、查看PSP内容
image.png
image.png
image.png
image.png
image.png
image.png