flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > About MATCH instruction

Author
Thread Post new topic Reply to topic
Roman



Joined: 21 Apr 2012
Posts: 591
Roman
MATCH is powerfull FASM comand.
But very little information on MATCH instruction.
For example how the match work whitch FORWARD ?

I created my macro forw and using match. Match very necessary.
I would want that my macro (forw ) created this code:
mov eax,10
mov eax,20
mov eax,30
mov eax,40

This my macro:
macro forw cR,[arg]
{ forward
match dst*src, arg
\{
mov cR,src
\}
}

In section code:
forw eax,10*20*30*40

But i get asm code : mov eax,24000
I understend why this happend, but how to get my result using MATCH?

PS: I found bug in join strings:
if we using match like this:
macro ff[arg]
match dst=src, arg
\{
invoke MessageBox,0,`dst#" my label","ok",0
invoke MessageBox,0,`arg#" my label","ok",0 ;This work fine
\}
We get messagebox text "dst my label". But its wrong !
Post 26 Mar 2013, 15:19
View user's profile Send private message Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 591
Roman
I appeal to Tomas. Tomas please help.
Post 26 Mar 2013, 15:30
View user's profile Send private message Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 7714
Location: Kraków, Poland
Tomasz Grysztar
Roman wrote:
if we using match like this:
macro ff[arg]
match dst=src, arg
\{
invoke MessageBox,0,`dst#" my label","ok",0
invoke MessageBox,0,`arg#" my label","ok",0 ;This work fine
\}
We get messagebox text "dst my label". But its wrong !
You need to escape the ` operator here, because when it is not escaped, it gets processed by outer MACRO, not the inner MATCH - so "dst" gets converted to string before the MATCH is processed at all. The correct line should be:
Code:
invoke MessageBox,0,\`dst\#" my label","ok",0    


For your initial problem some recursive processing may be needed (like having a macro that redefines itself). MATCH itself does not have ability to performs loops, and FORWARD is meaningless in the MATCH macro block (it is allowed for symmetry reasons, but it does nothing, since each MATCH block has always just one set of parameters).
Post 26 Mar 2013, 17:05
View user's profile Send private message Visit poster's website Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 591
Roman
Thanks Tomasz.
Whatever it was Fasm best of the best.
Thanks Tomasz for the wonderful FASM.

And also you Tomasz can make new instruction. Who will be deprived of restrictions like Match instruction.

Tomasz please tell me that no one would have heard.
Wink
When in new version FASM will new instructions ?
Post 26 Mar 2013, 17:10
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-2020, Tomasz Grysztar.

Powered by rwasa.