汇编-理解call,ret

; 有意思的东西,主函数调用子函数用汇编来理解
assume cs:codeseg
codeseg segment

start:    
main:
call sub1 ; 调用子函数1, push IP1
; do something
mov ax, 4c00H
int 21H

sub1:
call sub2 ;调用子函数2, push IP2
; do something 
ret    ; pop IP1, goto "call sub1".next_IP

sub2:
; do something 
ret ; pop IP2, goto "call sub2".next_IP


codeseg ends 
end start

有点像递归。

posted @ 2019-04-10 20:32  ashen~  阅读(338)  评论(0编辑  收藏  举报