flat assembler
Message board for the users of flat assembler.
Index
> Macroinstructions > How to distinguish the label and constant? |
Author |
|
CandyMan 17 Jan 2013, 13:43
How to distinguish the label and constant?
Code: ThisIsConst = 10 ThisIsLabel: if ThisIsLabel eqtype 0 end if _________________ smaller is better |
|||
17 Jan 2013, 13:43 |
|
shutdownall 17 Jan 2013, 18:55
Strange request - for what do you need it exactly ?
You should know if you define a label or a constant. |
|||
17 Jan 2013, 18:55 |
|
CandyMan 18 Jan 2013, 13:19
Thanks!
|
|||
18 Jan 2013, 13:19 |
|
revolution 19 Jan 2013, 16:08
shutdownall wrote: Strange request - for what do you need it exactly ? |
|||
19 Jan 2013, 16:08 |
|
baldr 19 Jan 2013, 19:28
revolution,
Surely for a macro (but if doesn't fit well). There should be some synergy between preprocessor and interpreter (at least we have rept for some calc), probably in 2.0 it'll prosper wildly. |
|||
19 Jan 2013, 19:28 |
|
seapoint 06 Jun 2013, 21:31
Recently I had a similar problem, but I wanted to discern between normal labels and everything else. The simplest way is just to use regexp in python
Code: import sys, re def main(argv): if len(argv) < 3: print "usage: %s <source asm> <output asm>" % argv[0] else: output_file = open(argv[2], 'w') input_file = open(argv[1], 'r') out = add_labels(input_file.read()) output_file.write(out) def add_labels(source): labels = [label[:-1] for label in re.findall("\w+:", source)] return "_ALL_LABELS equ %s\n" % ",".join(labels) + source if __name__ == "__main__": main(sys.argv) then you can just use if arg in <_ALL_LABELS>. For dynamic labels (generated by macros) I guess you can first preprocess asm source using fasm and get all labels from that? It would be great if fasm was written in python, with all "macros" as full python code. Literally everything would be possible, and it would probably be much faster, too. Maybe someday... |
|||
06 Jun 2013, 21:31 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.