flat assembler
Message board for the users of flat assembler.
![]() Goto page 1, 2 Next |
Author |
|
Overclick 05 Aug 2022, 00:11
Hey
Code: Main: if 1=2 Second: end if .subname: How to prevent Second.subname instead of Main.subname label? |
|||
![]() |
|
bitRAKE 05 Aug 2022, 01:11
Do you mean:
Code: Main: if 1=2 ..Second: end if .subname: |
|||
![]() |
|
revolution 05 Aug 2022, 08:32
I guess it hinges on the definition of "last global label". The documentation makes no mention of a "defined" label.
Code: org '0' if 0 x: .y: end if .z: ;display x ; error: undefined symbol 'x'. ;display x.y ; error: undefined symbol 'x.y'. display x.z ; 1 passes, 0 bytes. |
|||
![]() |
|
Overclick 05 Aug 2022, 09:35
Moderators renamed this thread but it is not about labels only.
Another examples: Code: Main: if 0 somedata db ? end if .sublabel: ; --> somedata.sublabel: |
|||
![]() |
|
revolution 05 Aug 2022, 09:40
somedata is also a label.
|
|||
![]() |
|
Overclick 05 Aug 2022, 09:47
Quote:
Ofcourse but you know what I mean |
|||
![]() |
|
Overclick 05 Aug 2022, 10:08
Can I choose global label somehow back?
Code: Main: define savelabel . if 0 somedata db ? end if ; ... revert global .sublabel: |
|||
![]() |
|
revolution 05 Aug 2022, 10:10
I think bitRAKE gave the answer above; to use double dots to avoid making a new "last global label" anchor.
|
|||
![]() |
|
Overclick 05 Aug 2022, 10:22
Quote:
I cannot do that |
|||
![]() |
|
ProMiNick 05 Aug 2022, 11:11
revolution wrote: I think bitRAKE gave the answer above; to use double dots to avoid making a new "last global label" anchor. I gues author wants understand what "last global label" is. How double dots help to define "last global label" in true condition and not define in false condition? He wants apply assembly time condition to definition of "last global label" like it works in fasmg. or will see in documentatiion that it is impossible. _________________ I don`t like to refer by "you" to one person. My soul requires acronim "thou" instead. |
|||
![]() |
|
revolution 05 Aug 2022, 11:26
The if is a red-herring. The "last global label" is set regardless of the condition.
The same for the double dot, it never sets the "last global label", regardless of any surrounding condition. |
|||
![]() |
|
Overclick 05 Aug 2022, 11:39
Quote:
No, it's not my words, it's moderated. I need some triks for my multisection macro. Where subsections mixed they can mix last global labels aswell that I don't want. 1) I need to save the last global label 2) Load it back after subsection pass Code: main: ... <-- savelabel somehow, I think to do that via struc if subsection somedata db 0 end if if 0 savedlabel: ;Load back end if .sublabel: |
|||
![]() |
|
Overclick 05 Aug 2022, 11:51
Code: struc getlastglobal { match global.rest, . \{ savedlabel equ global \} } ... .tempvar getlastglobal ... |
|||
![]() |
|
revolution 05 Aug 2022, 12:24
Label construction is done by the parser.
Struc is in the preprocessor. The preprocessor runs first. The parser runs next. So the preprocessor (struc) has no knowledge of label names. You can't break down label names with struc (or any other preprocessor directive (match, irp, etc.)) because the label names don't yet exist. Also note that the assembler processes if, which is after the label is constructed. So when you think of what you are trying to do just ignore the lines with if, they make no difference at all, and just make it more confusing. Basically there is no way to "save" the label name either before or after the parser runs. |
|||
![]() |
|
Overclick 05 Aug 2022, 12:36
revolution
How did my .namespace macro work then? I took the names, added marker and used that marked names. First of all I can take the names form redefined macros/struc like label,db,dd,etc |
|||
![]() |
|
revolution 05 Aug 2022, 12:41
Because names are not labels. You can add names together to construct other names. But only the parser can convert names into labels.
|
|||
![]() |
|
Overclick 05 Aug 2022, 12:55
So if labels exist the only I do is manipulating with names. Isn't it not enough for my task?
|
|||
![]() |
|
bitRAKE 05 Aug 2022, 14:32
Symbols are defined where they are - even in [fasmg]. Other techniques are needed to create a symbol in another context or address space. For example, create a local/double-dot symbol and then route a symbol in the desired context.
Code: Main: .Second: .subname: virtual at Main.Second Second: end virtual |
|||
![]() |
|
Overclick 05 Aug 2022, 21:32
Such a beautiful solution I've got
![]() All tested and works perfect. If local labels used user should use one-line subsection instead of big one. Code: .code Main: ..data Somearg db 0 ;I mark it by extra dot .submain: As my macro include source additional times for each global section I just skip the body of ..data subsection for wrong sections. |
|||
![]() |
|
Goto page 1, 2 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.