flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > how work if in macro ?

Author
Thread Post new topic Reply to topic
Roman



Joined: 21 Apr 2012
Posts: 1821
Roman 24 Jun 2022, 11:40
I wondering how not intuitive work if in macro.

Code:
macro up x {
if  x in <->
;if x = - i want do empty code.
 else
  movd xmm0,x
  end if 
}

up eax ;ok
up - ;fasm get error if-in<-> reserved word used as symbol
    
Post 24 Jun 2022, 11:40
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20410
Location: In your JS exploiting you and your system
revolution 24 Jun 2022, 11:50
You can quote it:
Code:
macro up x {
if `x eq '-'
        display 'skip me',10
else
        display 'use me',10
end if
}
up a
up -    
Post 24 Jun 2022, 11:50
View user's profile Send private message Visit poster's website Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1821
Roman 24 Jun 2022, 11:54
Thanks.
How i said, hard understood logic if in macro.
allways magic Smile
Post 24 Jun 2022, 11:54
View user's profile Send private message Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1821
Roman 25 Jun 2022, 10:26
This construction working?
Code:
macro up x {
if `x eq '-'
        display 'skip me',10
If `x eq '&' 
        display 'next', 10
else
        display 'use me',10
end if
}
    
Post 25 Jun 2022, 10:26
View user's profile Send private message Reply with quote
macomics



Joined: 26 Jan 2021
Posts: 1011
Location: Russia
macomics 25 Jun 2022, 11:08
Code:
format binary as 'txt'

macro up x {
if `x eq '-'
        display 'skip me',10
else if `x eq '&' 
        display 'next', 10
else
        display 'use me',10
end if
}

up a
up -
up &
up b    
fasm1 wrote:
fasm -m 1024 ./test.asm
flat assembler version 1.73.30 (1024 kilobytes memory)
use me
skip me
next
use me
1 passes, 0 bytes.
Code:
format binary as 'txt'

macro up [x] { reverse
if `x eq '-'
        display 'skip me',10
else if `x eq '&' 
        display 'next', 10
else
        display 'use me',10
end if
}

up a, -, &, b    
fasm1 wrote:
fasm -m 1024 ./test.asm
flat assembler version 1.73.30 (1024 kilobytes memory)
use me
next
skip me
use me
1 passes, 0 bytes.
Post 25 Jun 2022, 11:08
View user's profile Send private message Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1821
Roman 25 Jun 2022, 13:26
Thanks work fine.
Post 25 Jun 2022, 13:26
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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.