flat assembler
Message board for the users of flat assembler.

Index > Windows > error .local_label

Goto page 1, 2  Next
Author
Thread Post new topic Reply to topic
FoXx



Joined: 25 Feb 2025
Posts: 18
FoXx 23 Apr 2025, 13:07
Increasing the size of the procedure gives a local label error. Non-local labels (without a dot) do not cause errors. Are there any restrictions?


Description:
Filesize: 16.11 KB
Viewed: 1372 Time(s)

local_label.jpg


Post 23 Apr 2025, 13:07
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 23 Apr 2025, 13:50
Make sure there aren't any non-dot labels in between the local labels.
Code:
label1:
 .local1: ;  label1.local1
label_other:
 .local2: ;  label_other.local2    
Post 23 Apr 2025, 13:50
View user's profile Send private message Visit poster's website Reply with quote
FoXx



Joined: 25 Feb 2025
Posts: 18
FoXx 23 Apr 2025, 16:11
revolution wrote:
Make sure there aren't any non-dot labels in between the local labels.

Code:
proc MyFunc

_MyFuck: ; init one

.local_label1:
...
{asm code}
...
.local_labelN:

endp    

Will this syntax work correctly?
Post 23 Apr 2025, 16:11
View user's profile Send private message Reply with quote
AsmGuru62



Joined: 28 Jan 2004
Posts: 1708
Location: Toronto, Canada
AsmGuru62 23 Apr 2025, 16:20
So, how many lines in the procedure?
I am currently writing the IDE, so just curious to know.
Post 23 Apr 2025, 16:20
View user's profile Send private message Send e-mail 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 23 Apr 2025, 16:27
"proc MyFunc" is a wrapper that defines a label "MyFunc".

Then there is a new label "_MyFuck" that defines a new label. This new label "_MyFuck" will restart a new set of local labels. I suggest you rename "_MyFuck" to ".._MyFuck". Putting the double dots won't start a new label set.
Post 23 Apr 2025, 16:27
View user's profile Send private message Visit poster's website Reply with quote
macomics



Joined: 26 Jan 2021
Posts: 1151
Location: Russia
macomics 23 Apr 2025, 16:41
The error message shows a label without a dot, with which the name is joined with a dot (HTTPRequest.find_first). Such a name (without a dot) can be in the code before the jmp command, and not before the label is declared.
Post 23 Apr 2025, 16:41
View user's profile Send private message Reply with quote
FoXx



Joined: 25 Feb 2025
Posts: 18
FoXx 23 Apr 2025, 17:25
revolution, thanks for the tip. I just noticed that the name "_MyFunc" was autocorrected to something else.
Smile Not funny!
macomics wrote:
The error message shows a label without a dot, with which the name is joined with a dot (HTTPRequest.find_first). Such a name (without a dot) can be in the code before the jmp command, and not before the label is declared.

This is the name of the procedure and there is no other
Code:
proc HTTPRequest
...
.find_first:
...
.find_next:
...
endp    

If you declare a local variable an error "lpBuffer.scan"
Code:
proc MyProc

Local lpBuffer dd ?

...
.scan:

...
endp    
Post 23 Apr 2025, 17:25
View user's profile Send private message Reply with quote
macomics



Joined: 26 Jan 2021
Posts: 1151
Location: Russia
macomics 23 Apr 2025, 17:36
This means that the jmp command is in the right place, but the label is declared in the wrong place. Try running the
Code:
.find_first: jmp .undefined_name    
command next to the declaration of this label and get the label name without a dot in the error, which precedes your local one.
Code:
error: undefined symbol 'XXXX.undefined_name'.
; XXXX - That's the name that's causing you problems.    


Most likely, such an announcement is added by some kind of macro.

ADD: You don't give the whole procedure code so that you can poke your nose. But now EW is interfering with telepathy.
Post 23 Apr 2025, 17:36
View user's profile Send private message Reply with quote
FoXx



Joined: 25 Feb 2025
Posts: 18
FoXx 24 Apr 2025, 06:08
revolution and macomics, thank you for your good work.
It's not just the variable names that I'm making mistakes in. There's an unnecessary global label defined in the code.
Quote:
The basic rule for defining labels: do not mix global and local labels in a procedure.
Code:
proc MyFunc

.local_label1:  ;       MyFunc.local_label1             correctly

...

local_lable2:   ;       local_lable2.local_label1       this is not a local label

...

.local_labelN:  ;       local_lable2.local_labelN       change label name

endp    
Post 24 Apr 2025, 06:08
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 24 Apr 2025, 06:22
FoXx wrote:
Code:
proc MyFunc
...
local_lable2:   ;       local_lable2.local_label1       this is not a local label
...    
The label created there is "local_lable2" with no extra local part.
Code:
local_lable2:   ;       local_lable2    this is not a local label    
Post 24 Apr 2025, 06:22
View user's profile Send private message Visit poster's website Reply with quote
FoXx



Joined: 25 Feb 2025
Posts: 18
FoXx 24 Apr 2025, 09:50
revolution, isn't «local_lable2» without a dot a global label?
Post 24 Apr 2025, 09:50
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 24 Apr 2025, 09:55
FoXx wrote:
revolution, isn't «local_lable2» without a dot a global label?
Yes. It starts a new batch of local labels. It doesn't attach to a previous local label.
Post 24 Apr 2025, 09:55
View user's profile Send private message Visit poster's website Reply with quote
FoXx



Joined: 25 Feb 2025
Posts: 18
FoXx 24 Apr 2025, 14:28
I thought there were absolute and relative labels. Absolute ones are visible everywhere. Relative ones complement absolute ones. If you declare a label without a dot, it will be visible everywhere. Local label will change after each global label. Did I understand correctly?
Post 24 Apr 2025, 14: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 24 Apr 2025, 14:46
Labels never change. All labels are visible everywhere.
Code:
a:
 .b: ; a.b
 .c: ; a.c
d:
 .e: ; d.e
 .f: ; d.f
jmp a ; valid
jmp a.b ; valid
jmp .b ; invalid, no label d.b
jmp .f ; valid d.f
jmp d.f ; valid    
Post 24 Apr 2025, 14:46
View user's profile Send private message Visit poster's website Reply with quote
macomics



Joined: 26 Jan 2021
Posts: 1151
Location: Russia
macomics 24 Apr 2025, 14:58
FoXx wrote:
Did I understand correctly?
No. There is simply a labeling mechanism that concatenates a name starting with a dot with the previous one without a dot. He appeared in the structures.

When you declare a struct <name>, no labels appear. But after the instance is declared, the label name appears, which is concatenated to all the "local" names in the struct. This will only happen with the name without the dot.

Code:
struc A {
  .a db ?
  .b db ?
}

C  A
; C.a     db ?
; C.b     db ?
.Z A ; first .Z binds to C.b -> C.b.Z
; C.b.Z.a db ?
; C.b.Z.b db ?

mov ah, [C.a]    ; C.a
mov al, [C.b]    ; C.b
mov bl, [.Z.a]   ; C.b.Z.a
mov bh, [.Z.b]   ; C.b.Z.b
mov ch, [C.b.Z.a]; C.b.Z.a
mov cl, [C.b.Z.b]; C.b.Z.b

D  A
; D.a     db ?
; D.b     db ?
.Y A ; first .Y binds to D.b -> D.b.Y
; D.b.Y.a db ?
; D.b.Y.b db ?

mov ah, [C.a]    ; C.a
mov al, [C.b]    ; C.b
mov bl, [.Y.a]   ; D.b.Y.a
mov bh, [.Y.b]   ; D.b.Y.b
mov ch, [D.b.Y.a]; D.b.Y.a
mov cl, [D.b.Y.b]; D.b.Y.b
mov dh, [C.b.Z.a]; C.b.Z.a
mov dl, [C.b.Z.b]; C.b.Z.b
    


And there is no more labels process going on. In proc macros, all basic types are overloaded as struc to specify local in the procedure body. That's all that changes. That is, there is no declaration of a real byte instead of db, but simply 1 is added to the stack to local variables.

ADD: Now there is a namespace in fasmg.
Post 24 Apr 2025, 14:58
View user's profile Send private message Reply with quote
FoXx



Joined: 25 Feb 2025
Posts: 18
FoXx 27 Apr 2025, 07:15
macomics, I have another question.
Code:
proc MyFunction

.local_1:

..sub_local: ;  MyFunction.local_1.sub_local

.local_2:

endp    
how to extend label after dot?
Post 27 Apr 2025, 07:15
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, 07:23
Code:
proc MyFunction

.local_1:

.local_1.sub_local: ;  MyFunction.local_1.sub_local    
Post 27 Apr 2025, 07:23
View user's profile Send private message Visit poster's website Reply with quote
macomics



Joined: 26 Jan 2021
Posts: 1151
Location: Russia
macomics 27 Apr 2025, 08:17
or
Code:
macro global name { if 0
    label name
end if }

proc MyFunction

.local_1:

global MyFunction.local_1
.sub_local: ;  MyFunction.local_1.sub_local

global MyFunction
.local_2: ; MyFunction.local_2

endp    
Post 27 Apr 2025, 08:17
View user's profile Send private message Reply with quote
FoXx



Joined: 25 Feb 2025
Posts: 18
FoXx 27 Apr 2025, 09:47
revolution, I understand. An interesting option.
macomics, is it possible to declare a label twice?
Post 27 Apr 2025, 09:47
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, 09:54
The double dot (..) is to declare a non-local label without changing the base label. It is a special syntax specifically to support that.
Code:
a:   ; a
..b: ; ..b, doesn't change the base label a
.b:  ; a.b    
Most labels can only be declared once. With the only exception for the @@ label.
Post 27 Apr 2025, 09:54
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page 1, 2  Next

< 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.