flat assembler
Message board for the users of flat assembler.
Index
> Macroinstructions > FASM1: Skipping pieces of macro declaration |
Author |
|
Tomasz Grysztar 06 Mar 2021, 18:55
You could use a "macro builder" concept, which is a pattern that goes like this:
Code: macro MacroBuilder.begin definition& { macro MacroBuilder \{ macro definition \\{ \} } macro MacroBuilder.line content& { macro MacroBuilder \{ MacroBuilder content \} } macro MacroBuilder.end { MacroBuilder \} } Code: MacroBuilder.begin Foo rept 4 i:0 { MacroBuilder.line display `i } MacroBuilder.end Code: macro Foo { display '0' display '1' display '2' display '3' } |
|||
06 Mar 2021, 18:55 |
|
DimonSoft 06 Mar 2021, 19:22
So, that’s just a matter of creating a chain of macro redefinitions each adding its own piece of the expected result, right?
As a side question (and since I still don’t feel being able to dig through the whole FASM source), I wonder what is the effect of multiple macro redefinitions on compiler memory usage? Is it worth purging a macro or restoring a symbolic constant than is no longer needed? This is what was the source of the original question, and three macro definitions seem like a tradeoff that may not be worth paying. Last edited by DimonSoft on 06 Mar 2021, 19:54; edited 1 time in total |
|||
06 Mar 2021, 19:22 |
|
revolution 06 Mar 2021, 19:26
You can test the memory usage to confirm, but my testing showed that using purge/restore/restruc used more memory than simply overwriting with a new value/definition and/or just ignoring it for the rest of the source.
|
|||
06 Mar 2021, 19:26 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.