flat assembler
Message board for the users of flat assembler.

Index > Windows > error .local_label

Goto page Previous  1, 2
Author
Thread Post new topic Reply to topic
macomics



Joined: 26 Jan 2021
Posts: 1151
Location: Russia
macomics 27 Apr 2025, 10:33
FoXx wrote:
macomics, is it possible to declare a label twice?

In my example, there is no double declaration of labels.

It is based on the features of the preprocessor and assembler. The preprocessor is responsible for generating label names and all label directives are visible to it, but the assembler will simply skip the label directive because it is inside if 0 .. end if

That is, when the assembler needs to calculate the address for this name, it will be uniquely determined once. But the preprocessor will take note and concatenate the names with a string that occurs more than once in the text.
Post 27 Apr 2025, 10:33
View user's profile Send private message Reply with quote
FoXx



Joined: 25 Feb 2025
Posts: 18
FoXx 27 Apr 2025, 12:28
revolution, if I declare a label with two dots (..global), it will be visible from everywhere. And it will not change the following main label. Am I right?

macomics, I'm not very good at the intricacies of macros. Simple solutions work better for me.
Post 27 Apr 2025, 12:28
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20632
Location: In your JS exploiting you and your system
revolution 27 Apr 2025, 12:45
All labels are visible everywhere. fasm doesn't have the concept of global labels as a separate type, all labels are global.

The double-dot just means that the base label is not changed.

The single-dot just means to append the name to the current base label.
Code:
a:   ; base label is now a
b:   ; base label is now b
..c: ; base label is still b
.d:  ; label name is "b.d", base label is still b    
Post 27 Apr 2025, 12:45
View user's profile Send private message Visit poster's website Reply with quote
FoXx



Joined: 25 Feb 2025
Posts: 18
FoXx 28 Apr 2025, 07:44
I used the label syntax:
Code:
label@MyFunction: ; always global label    
Code:
proc Func_A
        ...
label@Func_A:
        ...
        jmp Func_end
endp
;-------------------
proc Func_B
        ...
label@Func_B:
        ...
        jmp Func_end
endp
;-------------------
proc Func_C
        ...
label@Func_C:
        ...
        jmp Func_end
endp
;-------------------
proc Func_D
        ...
label@Func_D:
        ...
        jmp Func_end
endp
;-------------------
proc Func_end
        ...
        ret
endp    
Now I'm tidying up the code.

revolution and macomics thanks for helping me understand.
Post 28 Apr 2025, 07:44
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page Previous  1, 2

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.