Define a function with parameters in MASM assembly language
assembly, masm
Solution
Yes, you can.
For example:
jumpIfEqual PROC var1:DWORD, var2:DWORD, jmpAddress:DWORD
mov eax,var1
cmp eax,var2
jne skip
pop eax
push jmpAddress
skip:
ret
jumpIfEqual ENDP
....
push OFFSET jumpToHere
mov eax, 5
push eax
push eax
call jumpIfEqual
Problem
I'm trying to write a function in x86 assembly language that will accept three parameters. Is it possible to define a function in MASM assembly language with multiple parameters? ``` //this is pseudocode: I'm trying to convert this to a valid macro in MASM //if var1 is equal to var2, jump to the label jumpToHere function jumpIfEqual(var1, var2, jumpToHere){ cmp var1, var2; je jumpToHere; } ``` If I could write a valid function to do this, then `jumpIfEqual(5, 5, jumpToHere)` would be equivalent to ``` cmp 5, 5; je jumpToHere; ```