flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > Label's name assembled with values of numerical constants. I

Author
Thread Post new topic Reply to topic
Benjamin



Joined: 06 Nov 2009
Posts: 7
Location: Kiev, Ukraine
Benjamin 17 Nov 2009, 12:04
For example, there are two calculated numerical constant: a=2 and b=55.
Can I make label with form label_(a)_(b) ?
I need "label_2_55:".

Help please![/b]

_________________
Benjamin
Post 17 Nov 2009, 12:04
View user's profile Send private message Send e-mail Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 17 Nov 2009, 16:54
Can those numerical constants be represented as "a equ 2" and "b equ 55"?

Because in that case:
Code:
a equ 2
b equ 55

match a b, a b {
label_#a#_#b:

}

jmp label_2_55 ; Just to confirm the label was defined as expected    
Post 17 Nov 2009, 16:54
View user's profile Send private message Reply with quote
Benjamin



Joined: 06 Nov 2009
Posts: 7
Location: Kiev, Ukraine
Benjamin 18 Nov 2009, 08:02
LocoDelAssembly wrote:
Can those numerical constants be represented as "a equ 2" and "b equ 55"? ...


Thank LocoDelAssembly!
But need than "a" and "b" was macros arguments, as:
Code:
a equ 2
b equ 55
macro lab x,y{
  match i j, x y \{label_#i#_#j:\}
} 
lab a,b
;jmp label_2_55 ;<-error: created "label_i_j"
    

_________________
Benjamin
Post 18 Nov 2009, 08:02
View user's profile Send private message Send e-mail Reply with quote
SFeLi



Joined: 03 Nov 2004
Posts: 138
SFeLi 18 Nov 2009, 08:09
Benjamin, you forgot to escape all #’s (\#).
Post 18 Nov 2009, 08:09
View user's profile Send private message Reply with quote
Benjamin



Joined: 06 Nov 2009
Posts: 7
Location: Kiev, Ukraine
Benjamin 18 Nov 2009, 08:19
SFeLi wrote:
Benjamin, you forgot to escape all #’s (\#).

_________________
Benjamin
Post 18 Nov 2009, 08:19
View user's profile Send private message Send e-mail 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.