flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > and/or match

Author
Thread Post new topic Reply to topic
Jin X



Joined: 06 Mar 2004
Posts: 133
Location: Russia
Jin X 14 Oct 2019, 11:44
Hello.
How can I make AND/OR condition for MATCH ?

Why this doesn't work:
Code:
a equ 1
b equ 0
match =1:0,a:b { nop }    

This is not so beautiful:
Code:
a equ 1
b equ 0
match =1,a { match =0,b \{ nop \} }    


The second question: why this always generates nop?
Code:
a equ 1
b equ 0
match 0,a { nop }    
Post 14 Oct 2019, 11:44
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8356
Location: Kraków, Poland
Tomasz Grysztar 14 Oct 2019, 11:50
Jin X wrote:
Why this doesn't work:
Code:
a equ 1
b equ 0
match =1:0,a:b { nop }    
"=" applies only to a single token. So this should look like:
Code:
a equ 1
b equ 0
match =1:=0,a:b { nop }    


Jin X wrote:
The second question: why this always generates nop?
Code:
a equ 1
b equ 0
match 0,a { nop }    
Preprocessor treats "0" as a name here, so this defines parameter called "0" which takes the value of variable "a":
Code:
a equ 1
b equ 0
match 0,a { display `0 }    
This is no different from, for example:
Code:
a equ 1
b equ 0
match O,a { display `O }    
But note that fasmg disallows a numeric name in such place, it is only fasm's preprocessor that allows it.
Post 14 Oct 2019, 11:50
View user's profile Send private message Visit poster's website Reply with quote
Jin X



Joined: 06 Mar 2004
Posts: 133
Location: Russia
Jin X 14 Oct 2019, 12:10
Thanks, Tomasz Smile
Can I realize OR condition in 'match'?
Can I realize ELSE brunch?
Post 14 Oct 2019, 12:10
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8356
Location: Kraków, Poland
Tomasz Grysztar 14 Oct 2019, 12:28
There is no option for an OR. And ELSE MATCH is only possible with fasmg. Also, fasmg has some kind of OR available in case-insensitive matching, though this has very limited capabilities.
Post 14 Oct 2019, 12:28
View user's profile Send private message Visit poster's website 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.