当前位置:网站首页>Assembly language (4) function transfer parameters

Assembly language (4) function transfer parameters

2022-06-25 01:14:00 Day-3

Register transfer parameters

assum cs:code

code segment
addx proc
	add si,di
	mov ax,si
	ret
addx endp
main proc
	mov si,5
	mov di,6
	call addx
	mov bx,ax
	mov ax,4C00H
	int 21H
main endp
start:call main
code ends
end start

Stack pass reference

About 16 Characteristics of stack under bit .
 Insert picture description here

assum cs:code

code segment
addx proc
	push bp
	move bp,sp
	mov si,[bp+4]
	mov di,[bp+6]
	add si,di
	mov ax,si
	pop bp
	ret
addx endp
main proc
	mov ax,5
	mov bx,6
	push ax
	push bx
	call addx
	add sp,4
	mov bx,ax
	mov ax,4C00H
	int 21H
main endp
start:call main
code ends
end start
原网站

版权声明
本文为[Day-3]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/176/202206242024382183.html