flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > [FASM1] How do I concatenate a value to a label?

Author
Thread Post new topic Reply to topic
stephen010x



Joined: 01 Feb 2022
Posts: 1
stephen010x
Ultimately, I am trying to create a macro that can do something like this:

Code:
newloop 5  ; the macro call
newloop 3 
newloop 8 
    

Code:
loop5:   ; what the macro sends out
loop3:
loop8:
    


But so far, all of my attempts to create something like this have failed. I am simply just not familiar enough with FASM. Anyone know how to do this?


EDIT:
I realize there was something I forgot to include in the original question. Here is what I am really trying to do:

Code:
x = 5
newloop x  ; the macro call
x = 3
newloop x 
x = 8
newloop x 
    

Code:
loop5:   ; what the macro sends out
loop3:
loop8:
    


I know that there are such thing as anonymous labels. But I would prefer avoid those if possible.


Last edited by stephen010x on 01 Feb 2022, 21:59; edited 1 time in total
Post 01 Feb 2022, 05:09
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 18480
Location: In your JS exploiting you and your system
revolution
Code:
macro newloop append { loop#append: }

newloop 5
newloop 3
newloop 8

jmp loop5
jmp loop3
jmp loop8    
Post 01 Feb 2022, 05:49
View user's profile Send private message Visit poster's website Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 445
Location: Ukraine
Overclick
Seems you need this
Code:
macro @@@ t& {
        local anonymous
        @F1=$
        @B5 equ @B4
        @B4 equ @B3
        @B3 equ @B2
        @B2 equ @B1
        @B1 equ @F1
        @F1 equ @F2
        @F2 equ @F3
        @F3 equ @F4
        @F4 equ @F5
        @F5 equ anonymous
        match =: arg,t \{ arg \} }    

Usage:
Code:
@@@: 
@@@:
@@@:
@@@: <jump moves you here>
@@@:
jmp @B2    
Post 01 Feb 2022, 12:00
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-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.