flat assembler
Message board for the users of flat assembler.

flat assembler > Macroinstructions > Help with a macro mod.

Author
Thread Post new topic Reply to topic
madmatt



Joined: 07 Oct 2003
Posts: 1046
Location: Michigan, USA
How would I make the latest 'proc' macro allow me to use "ret value", which would produce the code:
Code:
mov eax, value
retn
    
Post 12 Jul 2005, 07:24
View user's profile Send private message Reply with quote
Vasilev Vjacheslav



Joined: 11 Aug 2004
Posts: 392
macro return val
{
mov eax,val
ret
}
Post 13 Jul 2005, 04:24
View user's profile Send private message Reply with quote
madmatt



Joined: 07 Oct 2003
Posts: 1046
Location: Michigan, USA
hmmm, didn't think of making a separate macro, was putting the macro code right in with the 'proc' macro.
thanks! I'll give it a try
MadMatt
Post 13 Jul 2005, 17:56
View user's profile Send private message Reply with quote
madmatt



Joined: 07 Oct 2003
Posts: 1046
Location: Michigan, USA
Sorry, but I need something that works inside the 'proc' and 'cproc' macro(s), I need it to: mov eax, value:retn, not whatever it does now.
Post 14 Jul 2005, 00:27
View user's profile Send private message Reply with quote
Reverend



Joined: 24 Aug 2004
Posts: 408
Location: Poland
Replace ret macro from 'proc' with this:
Code:
    macro ret val
    \{ leave
       if ~ val eq
        mov eax, val
       end if
       if args
        retn args
       else
        retn
       end if \}    
Post 15 Jul 2005, 08:33
View user's profile Send private message Visit poster's website Reply with quote
madmatt



Joined: 07 Oct 2003
Posts: 1046
Location: Michigan, USA
I don't think this will work with the latest macros, the proc macro has now been broken into 3 or 4 pieces.
Post 15 Jul 2005, 14:42
View user's profile Send private message Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 7178
Location: Kraków, Poland
I suggest you to use the other name (like "return" proposed above - I recommend it as the best solution), since "ret value" for MASM compatibility now mean the same as "retn value" - encodes the single instruction, as opposed to "ret", which unrolls the whole epilogue code. I will soon finish documenting new "proc" in the Win32 Headers documentation, and it will tell you also how to enable custom prologue/epilogue.

The solution proposed by Reverend will also work, if you decide to use the custom definition of "proc" macro. However I tried to make "proc" customizable enough without the need to change standard headers.
Post 15 Jul 2005, 15:07
View user's profile Send private message Visit poster's website Reply with quote
madmatt



Joined: 07 Oct 2003
Posts: 1046
Location: Michigan, USA
I've been using July 8 release of the proc.inc, which works with the mod i've been using for the past couple of months (allowing: ret value), and updating all other macros to the latest release. This seems to work good so far. using the 'return' macro means I would have to go through and change all my sources again. Like you said, I'll just wait until the documentation is finished and see if I can mod it myself.
Thanks to all anyways!!
MadMatt
Post 15 Jul 2005, 17:47
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2019, Tomasz Grysztar.

Powered by rwasa.