flat assembler
Message board for the users of flat assembler.
Index
> Macroinstructions > [SOLVED][fasmg]CALM replacement to irpv usage macro example |
| Author |
|
|
bitRAKE 05 Jul 2026, 15:44
My thinking is that this is a result of when process takes place. The multi-pass solver does some actions immediately, some are allowed to change, and others must be done last. All are orchestrated based on class of action and location in source.
IRPV is in the "must happen now" class. MATCH is in the "we can wait" class. IRPV will also bypass if empty - very useful. In CALM you'd need to use TAKE to achieve the same effect and handle the empty case. Other directives can get the top value, but processing the empty signal is more complicated, imho. Have you tried TAKE dest,src? Perhaps this pattern might help? (Please, ignore all the extra question marks _________________ ¯\(°_o)/¯ AI may [not] have aided with the above reply. |
|||
|
|
Tomasz Grysztar 05 Jul 2026, 16:43
Jessé wrote: Also if someone can explain what differs from 'curr' value obtained from 'match' instead 'irpv', it will be of great value, continuing my learning process on fasmg. fasmg manual wrote: When a variable passed to "irpv" has a value that is not symbolic, the parameter is given a text that produces the same value upon computation. When the value is a positive number, the parameter is replaced with its decimal representation (similarly how the "%" parameter is processed), otherwise the parameter is replaced with an identifier of a proxy symbol holding the value from stack. Your CALM attempt therefore fails because it only handles the symbolic variables and not numeric ones. You need separate paths for these two cases, something like: Code: calminstruction put_value dest*, src* local tmp match src.equ, src, . jyes symbolic numeric: compute tmp, src publish dest, tmp exit symbolic: transform src publish dest, src end calminstruction |
|||
|
|
Tomasz Grysztar 05 Jul 2026, 16:48
Wait, this can be done much simpler:
Code: calminstruction put_value dest*, src* transform src jyes symbolic compute src, src symbolic: publish dest, src end calminstruction |
|||
|
|
Jessé 06 Jul 2026, 23:02
bitRAKE wrote: My thinking is that this is a result of when process takes place. The multi-pass solver does some actions immediately, some are allowed to change, and others must be done last. All are orchestrated based on class of action and location in source. Thank you for the explanations. Yes, I've tried several of those directives under CALM (including 'take'), but have not found myself one that works. But, it is a blind test, because there are several things I still need to figure out before recognizing myself as someone who understands CALM under fasmg fluently. But, as always, I just start it by trying and trying again. I must also admit that I need to review the whole thing I'm trying to adapt to CALM (as much as I can), because, as it is now, I just did something big, without that much experience. Anyways, I got a lot of success, converting some internals to CALM, and they're already behaving as I expect. |
|||
|
|
Jessé 06 Jul 2026, 23:08
Tomasz Grysztar wrote: Wait, this can be done much simpler: The answer is yes, I'm using it with numeric, as well as symbolic variables. The code suggested worked fine, and I have (for now) replaced my aforementioned 'irpv' block. 0 issues so far. Thanks for the valuable explanation. |
|||
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2026, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.