flat assembler
Message board for the users of flat assembler.
Index
> Main > macro arg in strings? |
Author |
|
LocoDelAssembly 05 Jun 2007, 02:21
Code: macro f arg { .a db `arg, 0 } However, things like "f a+b" will not work. To handle those situations as well you can use Code: macro f arg { label .a byte at $ irps symbol, arg \{db \`symbol\} db 0 } |
|||
05 Jun 2007, 02:21 |
|
lazer1 06 Jun 2007, 17:23
LocoDelAssembly wrote:
that functions correctly Quote:
[/quote] not completely sure what you mean, can you give an example of using this and what the effect is? |
|||
06 Jun 2007, 17:23 |
|
LocoDelAssembly 06 Jun 2007, 18:17
if you use the first one this happens:
Code: ; f a+b .a db 'a'+b, 0 Which will end up in a "Error: undefined symbol" due to the lack of "b" variable definition. Since obviously you don't want "b" to be handled as a variable instead of a string you have to iterate throughout all symbols and apply to them "`" separatelly because the "`" stops at the first symbol separator (a space or any of +-*/{}[]...). With the second macro this is what happens: Code: ;f a+b label .a byte at $ db 'a' db '+' db 'b' db 0 |
|||
06 Jun 2007, 18:17 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.