flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > numbered labels

Author
Thread Post new topic Reply to topic
daluca



Joined: 05 Nov 2005
Posts: 86
daluca 31 Aug 2007, 23:07
How can I make a macro to define numbered labels or symbols.
so if the name of the macro is def

this:

Code:

def
...
def
...
def
...

    


will produce this:

Code:

lab1:
...
lab2:
...
lab3:
...

    



thanks.
Post 31 Aug 2007, 23:07
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 31 Aug 2007, 23:55
Well, it was discussed already and what is worst is that I was involved...

Anyway, I'll try to recreate it (I have no way to test now)
Code:
COUNTER equ 0

macro def
{
  match counter, COUNTER
  \{
    rept 2 c:counter \\{COUNTER equ c\\}
  \}

  match counter, COUNTER
  \{
    lab\#counter:
  \}
}
    


I hope it works!

[edit] No, it doesn't work so I updated it. Now works but I think that the original was a little more simple [/edit]
Post 31 Aug 2007, 23:55
View user's profile Send private message Reply with quote
daluca



Joined: 05 Nov 2005
Posts: 86
daluca 01 Sep 2007, 20:49
Thanks LocodelAsembly: yes it works o.k. I was playing with the rept but I did not find the right way to use it.
Post 01 Sep 2007, 20:49
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.