flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > segment .main error (format MZ)

Author
Thread Post new topic Reply to topic
Dasn



Joined: 22 Nov 2004
Posts: 10
Dasn
Hello, guys.
If I use a segment name starts with a DOT, like '.main' with the 'segment' directive in 'format MZ', fasm throw me an error.

For example, the following code generates an error.
Code:
format MZ
entry .main:start

segment .text 
x       db      0xff

segment .main
start:
mov     ax, x
    


Quote:

entry .main:start
error: undefined symbol '.main'.


Yes, when I remove the DOT, say use the name as 'main' or whatever not starts with a dot, the error is gone; Also, I found that if I exchange the positions of the two segments (i.e. move the segment '.main' before the segment '.text'), the error is gone too.

Thanks if you comment. Smile
Post 22 Aug 2009, 08:46
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17341
Location: In your JS exploiting you and your system
revolution
Labels beginning with a dot are local labels and the name is attached to the end of any preceding non-local label. In the case above the previous non-local label is "x" and .main is attached to make x.main
Code:
format MZ
entry x.main:start

segment .text
x       db      0xff

segment .main
start:
mov     ax, x    
Post 22 Aug 2009, 09:27
View user's profile Send private message Visit poster's website Reply with quote
Dasn



Joined: 22 Nov 2004
Posts: 10
Dasn
revolution wrote:
Labels beginning with a dot are local labels and the name is attached to the end of any preceding non-local label. In the case above the previous non-local label is "x" and .main is attached to make x.main
Code:
format MZ
entry x.main:start

segment .text
x       db      0xff

segment .main
start:
mov     ax, x    


Thanks for your quick reponse, I get it now. Smile
Post 22 Aug 2009, 13:45
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-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.