我正在尝试用 x86 汇编语言编写一个接受三个参数的函数。是否可以用 MASM 汇编语言定义一个具有多个参数的函数?
//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;
}
如果我可以编写一个有效的函数来执行此操作,那么 jumpIfEqual(5, 5, jumpToHere)
将等同于
cmp 5, 5;
je jumpToHere;
最佳答案
例如:
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
关于assembly - 用 MASM 汇编语言定义带参数的函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15345645/