flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
Tomasz Grysztar 09 Apr 2017, 22:38
If you display `b instead of `a you may notice that it contains the "world, sweet-buns" text, nothing was lost. The problem here is that IRP does not evaluate symbolic constant in its arguments, so there is only one iteration and "argument" simply has value "arguments", which is later evaluated by MATCH. To process the list correctly you may need to do something like:
Code: match list,arguments irp argument, list match a-b, argument display `a end match end irp end match |
|||
![]() |
|
zhak 09 Apr 2017, 22:50
ah, sure, should have guessed about evaluating with match
![]() |
|||
![]() |
|
zhak 09 Apr 2017, 22:56
So, if a value is referenced by macro argument name (args), it gets evaluated inside macro and irp works fine. But using "define"/"redefine" I just created a link to what is contained in "more" and it is not evaluated. In order to evaluate value defined with "define", I should use "match". am I right?
|
|||
![]() |
|
Tomasz Grysztar 10 Apr 2017, 07:35
Macroinstruction arguments and all parameters in general (because "argument" defined by IRP is also a parameter of the same kind as argument to macro) are replaced with their value text before processing each line. So for example you can do things like:
Code: irp statement, x = 'OK', display x, restore x statement end irp On the other hand symbolic variables are regular expression-class symbols just like numeric ones, and they are only evaluated inside expressions. It obviously needs to be this way, because if the symbolic variables were replaced with their values before processing a line you would not even be able to re-define such variable - if in statement like "a equ b" the "a" was replaced with its value you could end up with a completely different instruction. In addition to evaluating them in expressions (numeric and logical ones) symbolic variables are also processed in two special cases - in the value of EQU definition and in the second argument of MATCH. This is inherited from fasm 1, since it worked out there. There is in fact a strong analogy between these rules and the operation of preprocessor in fasm 1. There replacement of symbolic variables occurred only after the preprocessor interpreted the line and found no instruction for itself to execute, so any preprocessor directives were not affected, including ones like IRP. And the only two special places where this replacement was done in the text of such directives were the second arguments to EQU and MATCH. As for the methods of converting a value of symbolic variable to a preprocessed parameter, there are two, both mentioned in the fasmg manual. One is with IRPV and the other one with MATCH. |
|||
![]() |
|
Tomasz Grysztar 10 Apr 2017, 07:42
zhak wrote: fasmg is so complex, yet so much fun! ![]() |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.