flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > backward label undefined

Author
Thread Post new topic Reply to topic
CandyMan



Joined: 04 Sep 2009
Posts: 414
Location: film "CandyMan" directed through Bernard Rose OR Candy Shop
CandyMan 03 Apr 2017, 07:44
Code:
if Z-Y>0
@@:
else
@@:
end if
jnz @B  ;undefined symbol
Y:
db 0
Z:    

_________________
smaller is better
Post 03 Apr 2017, 07:44
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8356
Location: Kraków, Poland
Tomasz Grysztar 03 Apr 2017, 08:28
The @@ label implementation in fasm 1 is in the parser stage before the actual assembly takes place and therefore it is not affected by IF conditions. The "@B" in your sample refers to the second "@@" regardless whether the line later is assembled or not.

You can look at it as if the parser created an unique name for each @@ label (like what fasm's preprocessor does for LOCAL labels) and this is how your sample then looks like to the assembler:
Code:
if Z-Y>0
anonymous1:
else
anonymous2:
end if
jnz anonymous2
Y:
db 0
Z:    
The new fasmg engine has no such limitations since it got rid of a separate stages.


Last edited by Tomasz Grysztar on 03 Apr 2017, 08:35; edited 1 time in total
Post 03 Apr 2017, 08:28
View user's profile Send private message Visit poster's website Reply with quote
CandyMan



Joined: 04 Sep 2009
Posts: 414
Location: film "CandyMan" directed through Bernard Rose OR Candy Shop
CandyMan 03 Apr 2017, 08:35
all right, I thank for the explanation.

_________________
smaller is better
Post 03 Apr 2017, 08:35
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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.