flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > How to concatenate two lines with preprocessor?

Author
Thread Post new topic Reply to topic
Z3N



Joined: 01 Oct 2009
Posts: 17
Z3N 25 Mar 2010, 11:43
Whether it is possible?

Example:
Code:
first equ 'head'
second equ 'body'

concatenate first,second

OUT:

first equ 'headbody'
    

"@concatenate"is invented macro.

_________________
"There will be no more delay!" (Revelation 10)
Post 25 Mar 2010, 11:43
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 25 Mar 2010, 12:24
AFAIK, FASM can't concatenate two string into single one (string handling is generally one of weak spots of FASM).
Post 25 Mar 2010, 12:24
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20630
Location: In your JS exploiting you and your system
revolution 25 Mar 2010, 13:10
Code:
first equ 'head'
second equ 'body'

match xx yy,first second {first equ xx#yy}

display first

use64
mov rax,first    
Post 25 Mar 2010, 13:10
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 25 Mar 2010, 13:16
oh... nevermind me reply then Smile
Post 25 Mar 2010, 13:16
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20630
Location: In your JS exploiting you and your system
revolution 25 Mar 2010, 13:21
If you need it as a macro:
Code:
macro concatenate x,y{match xx yy,x y\{x equ xx\#yy\}}

first equ 'head'
second equ 'body'

concatenate first,second

display first

use64
mov rax,first    
Post 25 Mar 2010, 13:21
View user's profile Send private message Visit poster's website Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2139
Location: Estonia
Madis731 25 Mar 2010, 13:35
But crossing a line isn't possible. For example:
<head>
<body>
...

here concat wouldn't work. The same problem is with multi-line comments.
Post 25 Mar 2010, 13:35
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
Z3N



Joined: 01 Oct 2009
Posts: 17
Z3N 28 Mar 2010, 11:46
revolution wrote:
Code:
first equ 'head'
second equ 'body'

match xx yy,first second {first equ xx#yy}

display first

use64
mov rax,first    


Great! It's work!!!
Big thx!!!

_________________
"There will be no more delay!" (Revelation 10)
Post 28 Mar 2010, 11:46
View user's profile Send private message Reply with quote
Tyler



Joined: 19 Nov 2009
Posts: 1216
Location: NC, USA
Tyler 28 Mar 2010, 12:14
@vid: see http://flatassembler.net/docs.php?article=manual#2.3.3

Scroll until you get to
Code:
macro jif op1,cond,op2,label
     {
        cmp op1,op2
        j#cond label
     }
    

The paragraph below that explains the method revolution used(and a few others). I didn't know about it either Smile.
Post 28 Mar 2010, 12:14
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-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.