1 year ago

#198930

test-img

Ariel Yael

using function parameters in assembly after pushing registers (pusha saving state)

From what I understand (correct me if I'm mistaken), I can do the following:

push param3
push param2
push param1
call func1

and then inside func1 I can access these params by doing this:

proc func1:
    push bp
    
    mov bp, sp

    mov ax, [bp+8] ; param1
    mov ax, [bp+6] ; param2
    mov ax, [bp+4] ; param3

endp

But what if instead of pushing just bp, I would've pushed more registers? or used pusha? how would this effect the parameter accessing. What is the logic behind this when looking at the stack?

function

assembly

parameters

parameter-passing

tasm

0 Answers

Your Answer

Accepted video resources