News:

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

Macros

Started by GUAN DE DIO, August 31, 2008, 06:32:12 PM

Previous topic - Next topic

GUAN DE DIO

Hi everybody,

      I'm making a macro and I need to load the value of a register into a local macro variable.

      I try several way, the last try has been this:

             Index = rsp

     How can I do this?

Best Regards,
GUÄN

qWord

hi,

it is impossible what are you trying to do. Macros are expand before masm assemble your program, so macro-variables exist only at assembly-time - not at run-time!

what should your macro do ?

regards,
qWord
FPU in a trice: SmplMath
It's that simple!

GUAN DE DIO

Thanks for the request.

    I'll do it in a different way.

    I do not why my 64 bits program runs without problem in WinXP64 and in Vista 64 I have stack alignment problem when I call an API.

    With this macro I`ll try to detect if the stack is wrong and fix it making an additional push before the calling

GUAN

MazeGen

Guan, you might be interested in this way of automatic stack alignment, invented by Jeremy Gordon:

http://www.jorgon.freeserve.co.uk/GoasmHelp/64bits.htm#invokec

The code to achieve the alignment is ugly and size-consuming, but works well.

It could be done automatically at compile time if you keep tracking of all PUSH/POP instructions and if you follow specific model of code arrangement, but still, it woud be complicated to code all neccessary macros.

GUAN DE DIO

Thanks

    This code is very similar to my code, but that is more optimized