flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > Use an argument passed to a macro to name another macro?

Author
Thread Post new topic Reply to topic
Azu



Joined: 16 Dec 2008
Posts: 1159
Azu 24 Dec 2009, 05:00
What am I doing wrong?

Code:
macro      foobar  instruction,args{
      \macro instruction,args{
              instruction     args
                if defined arg1
                     display arg1
                end if
      \}
}
foobar    mov,<arg1*,arg2*>
mov  eax,1
ret    


I also tried it like this;

Code:
macro      foobar  instruction,args{
      \macro `instruction,`args{
            `instruction    `args
               if defined arg1
                     display arg1
                end if
      \}
}
foobar    mov,<arg1*,arg2*>
mov  eax,1
ret    



Please help..

_________________
Post 24 Dec 2009, 05:00
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger ICQ Number Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20299
Location: In your JS exploiting you and your system
revolution 24 Dec 2009, 05:11
Code:
macro   foobar  instruction,args{
        macro  instruction [args] \{
         \common
                instruction     args
                ;if defined arg1
                ;        display arg1
                ;end if
        \}
}
foobar  mov,<arg1,arg2>
mov     eax,1
ret    
Post 24 Dec 2009, 05:11
View user's profile Send private message Visit poster's website Reply with quote
Azu



Joined: 16 Dec 2008
Posts: 1159
Azu 24 Dec 2009, 05:56
Thank you Smile

_________________
Post 24 Dec 2009, 05:56
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger ICQ Number Reply with quote
Azu



Joined: 16 Dec 2008
Posts: 1159
Azu 25 Dec 2009, 05:31
What is the correct way to use forward when constructing a macro?


Code:
macro   foobar  instruction,args,[forwardMe]{ 
        macro  instruction [args] \{ 
                \common 
                instruction     args 
forward
                instruction     forwardme
common
                ;if defined arg1 
                ;        display arg1 
                ;end if 
        \} 
} 
foobar  mov,<arg1,arg2>,ret,int3
mov     eax,1 
ret    


Doesn't compile Confused

_________________
Post 25 Dec 2009, 05:31
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger ICQ Number Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20299
Location: In your JS exploiting you and your system
revolution 25 Dec 2009, 05:35
Did you mean:
Code:
macro   foobar  instruction,args,[forwardMe]{ 
common
        macro  instruction [args] \{ 
                \common 
                instruction     args 
forward
                forwardMe
common
                ;if defined arg1 
                ;        display arg1 
                ;end if 
        \} 
} 
foobar  mov,<arg1,arg2>,ret,int3
mov     eax,1 
ret    
Post 25 Dec 2009, 05:35
View user's profile Send private message Visit poster's website Reply with quote
Azu



Joined: 16 Dec 2008
Posts: 1159
Azu 25 Dec 2009, 05:47
Oops Embarassed

That was stupid of me too lol. But the problem I was having in my code was I used forward somewhere else and forgot to put a common after it. So it was trying to make the whole macro for each extra thing on the end. x_x

_________________
Post 25 Dec 2009, 05:47
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger ICQ Number 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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.