flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > Macro arguments in the calculations

Author
Thread Post new topic Reply to topic
hidden



Joined: 14 Feb 2007
Posts: 49
hidden 14 Feb 2007, 20:20
While I was typing my program, I discovered this situation. FASM macroprocesso doesn't separate arguments and apply to them usual operator's priority.

macro _db v { db v and 0FFh }

_db 0FFFh + 0 ; db 0FFFh + (0 and 0FFh)

That what I've done to all my calculations inside macro blocks.

macro _db v { db (v) and 0FFh }

_db 0FFFh + 0 ; db (0FFFh + 0) and 0FFh

It's not a bug, but may be useful in the manual.

PS Thx, it's the best assembler I've ever seen Smile
PPS I would like to see in future version possibility to add debug information to the (PE)executable files.

_________________
Image Lang: (eng|рус)
Post 14 Feb 2007, 20:20
View user's profile Send private message Reply with quote
Borsuc



Joined: 29 Dec 2005
Posts: 2465
Location: Bucharest, Romania
Borsuc 16 Feb 2007, 17:13
Hi

Macroprocessor doesn't apply operator priority, it just replaces the parameters with the given text Wink and it isn't supposed to make things unexpectedly like prioritying the operators
Post 16 Feb 2007, 17:13
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 16 Feb 2007, 22:15
hidden: if you read manual carefully, you will see that macro does just textual substition. then, it is clear that:
Code:
macro _db v { db v and 0FFh }
_db 0FFFh + 0 ;    
becomes
Code:
db 0FFFh + 0 and 0FFh    

and
Code:
macro _db v { db (v) and 0FFh } 
_db 0FFFh + 0    

becomes
Code:
db (0FFFh+0) and 0FFh    
Post 16 Feb 2007, 22:15
View user's profile Send private message Visit poster's website AIM Address 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-2023, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.