I need an example/skeleton for ASM32 routine for WIN32. I need to add some functions in C written in asm that comply with WIN32.
I don't know how to pass/retrieve params from asm routines.

Anybody?
Posted on 2002-04-07 10:05:05 by DIGITALMECHINIC
As long as the calling convention of the assembly function is fully compatable with any of those supported by the C compiler you use to call it then it should be trivial.

The standard calling convention in windows 32bit programming is the STDCALL convention (whose details should be dealt with by MASM, but particulars can be read from many locations and a quick search should get you more information than I can tell you).

You could also define external variables using the extern keyword.

This covers the passing of data to the assembly routine, as for return data, this is passed in the eax register, or a pointer to it is contained within eax when appropriate.

The only other way to modify program data from within a function is to do so via pointers to that data, in which case the format of the data must be known as the (default) type checking in assembly programming is much weaker.

If you post an attempt, we could correct you, but considering there are so many options available to you as a programmer it is difficult to answer such a broad ranging question.
One solution will not necessarily provide you with an answer that satisfies your problem.

Mirno
Posted on 2002-04-07 13:46:52 by Mirno
Please read Iczelion's Tutorials they explain such matters in great details, much better than i am able to do :)

Basically most Win32 API use STDCALL convention but wsprintf function is the notably exception that uses C Calling conventions

you can use API functions like this:

for MASM:
invoke MyAPIfunctionName,param1,param2,param3 ....

or for TASM:
call MyAPIfunctionName,param1,param2,param3 ....

you get API function Names and parameters count/names from any standard API help or even better the MSDN
Posted on 2002-04-07 13:47:48 by BogdanOntanu