flat assembler
Message board for the users of flat assembler.

Index > Main > Undefined symbol

Author
Thread Post new topic Reply to topic
Mat-Quasar



Joined: 02 Mar 2025
Posts: 26
Mat-Quasar 09 Mar 2025, 13:53
The following code is the simplified version of the program I am working with.

It won't compile (see error message in attached screenshot).
Solution either (1) Rename '.mine' to 'mine' , or (2) Remove 'start_loop:'

Is this a fasm bug?

Code:
format PE console

section '.data' data readable writeable
_key dd ?

section '.text' code readable executable
entry $
   jmp .mine

start_loop:

.mine:
    


Description: Error message
Filesize: 6.41 KB
Viewed: 330 Time(s)

undefined.PNG


Post 09 Mar 2025, 13:53
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20519
Location: In your JS exploiting you and your system
revolution 09 Mar 2025, 14:26
Mat-Quasar wrote:
Is this a fasm bug?
Nope.
Code:
   jmp start_loop.mine

start_loop:

.mine    ; label name ---> start_loop.mine    
Post 09 Mar 2025, 14:26
View user's profile Send private message Visit poster's website Reply with quote
Mat-Quasar



Joined: 02 Mar 2025
Posts: 26
Mat-Quasar 09 Mar 2025, 14:32
revolution wrote:
Mat-Quasar wrote:
Is this a fasm bug?
Nope.
Code:
   jmp start_loop.mine

start_loop:

.mine    ; label name ---> start_loop.mine    


But this also same:

Code:
format PE console

section '.data' data readable writeable
_key dd ?

section '.text' code readable executable
entry $
   jmp .mine

start_loop:
   ret

.mine:     


The problem is why "_key.mine"?
Post 09 Mar 2025, 14:32
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20519
Location: In your JS exploiting you and your system
revolution 09 Mar 2025, 14:35
Labels beginning with a single dot are attached to the most recent non-dot label.
Code:
a:
..b:
.c: ; a.c
d:
.e: ; d.e    
Post 09 Mar 2025, 14:35
View user's profile Send private message Visit poster's website Reply with quote
Mat-Quasar



Joined: 02 Mar 2025
Posts: 26
Mat-Quasar 09 Mar 2025, 14:37
revolution wrote:
Labels beginning with a single dot are attached to the most recent non-dot label.
Code:
a:
..b:
.c: ; a.c
d:
.e: ; d.e    


Ah, I see, learnt something new.

If I rename "start_loop" to ".start_loop", it is compiling. Smile
Post 09 Mar 2025, 14:37
View user's profile Send private message Reply with quote
dosmancer



Joined: 20 Feb 2025
Posts: 7
Location: Kingdom of Sweden
dosmancer 09 Mar 2025, 14:37
Manual section 2:

Quote:

Every symbol has its own namespace of descendants, called child namespace. When two names are connected with a dot (with no whitespace in between), such identifier refers to an entity named by the second one in the namespace of descendants to the symbol specified by the first one. This operation can be repeated many times within a single identifier, allowing to refer to descendants of descendants in a chain of any length.

space:
space.x = 1
space.y = 2
space.color:
space.color.r = 0
space.color.g = 0
space.color.b = 0
Any of the names in such chain may optionally be followed by the "?" character to mark that it refers to a case-insensitive symbol. If "?" is inserted in the middle of the name (effectively splitting it into separate tokens) such identifier is considered a syntactical error.

When an identifier starts with a dot (in other words: when the name of the parent symbol is empty), it refers to the symbol in the namespace of the most recent regular label defined before current line. This allows to rewrite the above sample like this:

space:
.x = 1
.y = 2
.color:
.color.r = 0
.color.g = 0
.color.b = 0
After the "space" label is defined, it becomes the most recently defined normal label, so the following ".x" refers to the "space.x" symbol and then the ".color" refers to the "space.color".
Post 09 Mar 2025, 14:37
View user's profile Send private message Reply with quote
Mat-Quasar



Joined: 02 Mar 2025
Posts: 26
Mat-Quasar 09 Mar 2025, 14:51
dosmancer wrote:
Manual section 2:

Quote:

Every symbol has its own namespace of descendants, called child namespace. When two names are connected with a dot (with no whitespace in between), such identifier refers to an entity named by the second one in the namespace of descendants to the symbol specified by the first one. This operation can be repeated many times within a single identifier, allowing to refer to descendants of descendants in a chain of any length.

space:
space.x = 1
space.y = 2
space.color:
space.color.r = 0
space.color.g = 0
space.color.b = 0
Any of the names in such chain may optionally be followed by the "?" character to mark that it refers to a case-insensitive symbol. If "?" is inserted in the middle of the name (effectively splitting it into separate tokens) such identifier is considered a syntactical error.

When an identifier starts with a dot (in other words: when the name of the parent symbol is empty), it refers to the symbol in the namespace of the most recent regular label defined before current line. This allows to rewrite the above sample like this:

space:
.x = 1
.y = 2
.color:
.color.r = 0
.color.g = 0
.color.b = 0
After the "space" label is defined, it becomes the most recently defined normal label, so the following ".x" refers to the "space.x" symbol and then the ".color" refers to the "space.color".


Thank you, next time I should look into the manual first. Razz
Post 09 Mar 2025, 14:51
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


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