CALL 和 ret 指令

assume cs:code

code segment

main:   mov ax,1
        mov bx,2
        call s                ;执行子程序 s
        add ax,bx
        mov ax,4c00h          ;执行后ax=5 bx=2
        int 21h
     s: add ax,bx             ;s子程序
        ret                   ;相当于返回到CALL 执行CALL下一条指令 ,(堆栈取IP_执行call指令已压入堆栈)
        
code ends
end main


 

posted @ 2013-11-21 14:25  yangsan  阅读(157)  评论(0编辑  收藏  举报