News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

"call" function

Started by mf, March 15, 2006, 11:50:14 PM

Previous topic - Next topic

mf

Hello,

I was looking over some assembler code written for MASM and cam across many statements of the form:

call FunctionName, ebx

when I try to assemble the code I get a syntax error with the ,

I tried to find the syntax for the call statement and they all seem to indicate that the appropriate syntax is:

call FunctionName

Could someone please confirm if the call statement can accept a second operand preceded by a ','?

I am perplexed because the code that I am reviewing has been posted for sometime for students to understand the program.

Thank-you,

MF

sluggy

To use a CALL, you need to have PUSHed all the parameters onto the stack first, the CALL instruction can only take a label or an address. To use a more HLL approach and list the parameters along with the "call", you could use the INVOKE macro, which takes the form:


invoke <yourFunctionName>, param1, param2, ......




lingo

mf, :wink

"... the appropriate syntax is:

call FunctionName "


that's right!
if the function has parameters
for instance: param1 and param2

you must use:

push param2
push param1
call FunctionName


".... many statements of the form:"

call FunctionName, ebx

may be: invokeĀ  FunctionName, ebx ;
orĀ  invoke param1, param2


invoke is a macro and does the same:
push param2
push param1
call FunctionName

If you have a problems with assembly syntax
rules just try to disassembly exe file
or see it under debugger.
They work with pure assembly code (without macros)

Regards,
Lingo




hutch--

mf,

> call FunctionName, ebx

This is actually TASM notation which performs nearly the same function as the MASM "invoke".

CALL is properly an Intel mnemonic which only accepts a single argument.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php