flat assembler
Message board for the users of flat assembler.
Index
> Main > Constants within macros |
Author |
|
Frank 27 Jul 2005, 17:42
It is possible, see the example below.
Code: ; Declare two macros macro my_numeric constant_name, constant_value { constant_name = constant_value } macro my_symbolic constant_name, constant_value { constant_name equ constant_value } ; Apply the macros my_numeric A_NUMERIC, 0x100 my_symbolic A_SYMBOLIC, SomeString ; Test the results if (defined A_NUMERIC) display 'A_NUMERIC is defined',13,10 end if if (A_NUMERIC = 100h) display 'A_NUMERIC equals 100h',13,10 end if if (defined A_SYMBOLIC) display 'A_SYMBOLIC is defined',13,10 end if if (A_SYMBOLIC eq SomeString) display 'A_SYMBOLIC equals SomeString',13,10 end if Note that the output differs slightly for numerical constants versus symbolic constants: Code:
A_NUMERIC is defined
A_NUMERIC equals 100h
A_SYMBOLIC equals SomeString
Regards Frank |
|||
27 Jul 2005, 17:42 |
|
pini 27 Jul 2005, 20:15
You're right, it works ! I don't know what I did wrong when I tested it, anyway it doesn't really matter
Thanks a lot pini |
|||
27 Jul 2005, 20:15 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.