flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
Roman 27 Jan 2019, 03:25
And i not understood why irpv use v and __applied.
I read fasm pdf but little information about irpv. And not full irpv explanation. |
|||
![]() |
|
QuarkMan 21 Sep 2019, 15:33
You need to preprocess the symbol "template.z2" again, I think...
|
|||
![]() |
|
Tomasz Grysztar 21 Sep 2019, 16:14
Your problem is not related to IRPV, it is about the difference between EQU and DEFINE.
With EQU you have symbolic variables expanded within the text before the assignment: Code: template.regstr EQU EBP template.z2 EQU [template.regstr+8] ; the value is: [EBP+8] DEFINE template.z2 [template.regstr+8] ; the value is: [template.regstr+8] The other problem is that in fasm 1 (as opposed to fasmg) the processing of symbolic variables is never recursive, so if "template.z2" is replaced with "[template.regstr+8]", no further replacement of "template.regstr" is done. To get around this, you need to add another pass of replacements, like this: Code: macro apply [v] { define __applied v v equ template.#v match vv, v \{ ; do additional pass of symbolic variable replacements vv \} } Code: template.regstr EQU EBP DEFINE template.z2 [template.regstr+8] template.zh EQU mov template.z2,eax ; the value is: mov [template.regstr+8],eax If you needed even more layers, for example if you used DEFINE in both places: Code: template.regstr EQU EBP DEFINE template.z2 [template.regstr+8] DEFINE template.zh mov template.z2,eax Code: macro apply [v] { define __applied v v equ template.#v match vv, v \{ match vvv, vv \\{ vvv \\} \} } |
|||
![]() |
|
QuarkMan 21 Sep 2019, 17:23
Since we are talking about IRPV, I would like to take the time to solve the problem in this file.
I don't understand why IRPV resolves the "super.cName\#.FinalVariables" symbol and also shows the contents of the "super.cName\#.StaticVariables" symbol.
|
|||||||||||
![]() |
|
QuarkMan 21 Sep 2019, 18:06
I ended up modifying a piece of code to the following:
Code: class Object: { Object.StaticVariables equ A Object.FinalVariables equ B Object.FinalVariables equ C } And miraculously it worked the way it should. ![]() It seems that the problem isn't wiht IRPV, but the MACRO "int", inside the "if" statement. But, strangely, even with the previous code, the "Display" inside "if" seems to work perfectly. ![]() |
|||
![]() |
|
Tomasz Grysztar 21 Sep 2019, 18:14
QuarkMan wrote: Since we are talking about IRPV, I would like to take the time to solve the problem in this file. In fasm 1 EQU is not affected by IF directive, because EQU is a directive of preprocessor, so all EQU definitions and macros are already processed away at the time when the assembler sees the IF directive (see a thread about fasm's layers for a bit of context). Therefore in your macro "int" both EQU definitions end up being actually defined, because preprocessor does not see or understand IF. |
|||
![]() |
|
QuarkMan 21 Sep 2019, 19:01
Oh, thanks. I'll try to do this in other way.
|
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.