就看下面这个例子吧
assume cs:code
stack segment
db 16 dup (0)
stack ends
code segment
mov ax,4c00h
int 21h
start: mov ax,stack
mov ss,ax
mov sp,16
mov ax,0
push cs
push ax
mov bx,0
retf
code ends
end start
debug 的结果为:
C:\masm5>debug 10b.exe
-r
AX=0000 BX=0000 CX=0026 DX=0000 SP=0000 BP=0000 SI=0000 DI=0000
DS=0B5A ES=0B5A SS=0B6A CS=0B6B IP=0005 NV UP EI PL NZ NA PO NC
0B6B:0005 B86A0B MOV AX,0B6A
-u
0B6B:0005 B86A0B MOV AX,0B6A
0B6B:0008 8ED0 MOV SS,AX
0B6B:000A BC1000 MOV SP,0010
0B6B:000D B80000 MOV AX,0000
0B6B:0010 0E PUSH CS
0B6B:0011 50 PUSH AX
0B6B:0012 BB0000 MOV BX,0000
0B6B:0015 CB RETF
0B6B:0016 FF365607 PUSH [0756]
0B6B:001A E821FC CALL FC3E
0B6B:001D 83C402 ADD SP,+02
0B6B:0020 FF065607 INC WORD PTR [0756]
0B6B:0024 5E POP SI
-t
AX=0B6A BX=0000 CX=0026 DX=0000 SP=0000 BP=0000 SI=0000 DI=0000
DS=0B5A ES=0B5A SS=0B6A CS=0B6B IP=0008 NV UP EI PL NZ NA PO NC
0B6B:0008 8ED0 MOV SS,AX
-t
AX=0B6A BX=0000 CX=0026 DX=0000 SP=0010 BP=0000 SI=0000 DI=0000
DS=0B5A ES=0B5A SS=0B6A CS=0B6B IP=000D NV UP EI PL NZ NA PO NC