flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > Anonymous labels in repeat statements

Author
Thread Post new topic Reply to topic
nmaps



Joined: 26 Oct 2012
Posts: 8
nmaps
Anonymous labels do not appear to work in repeat statements (using the latest version of fasm).

Sample:
Code:
repeat 3
        sub ecx, 1
        jl @f
        lodsb
    @@: 
        shl eax, 8
end repeat    
[/code]
Post 03 Sep 2013, 05:25
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7725
Location: Kraków, Poland
Tomasz Grysztar
During the assembly stage in fasm labels correspond to fixed points in source, so this repeated block tries to re-define the same label three times. To get the result you expect you should use the REPT directive and allow preprocessor to generate a separate piece of source (and thus a separate label) for each repetition:
Code:
rept 3 {
        sub ecx, 1 
        jl @f 
        lodsb 
    @@:  
        shl eax, 8
}    
Post 09 Sep 2013, 20:56
View user's profile Send private message Visit poster's website Reply with quote
l_inc



Joined: 23 Oct 2009
Posts: 881
l_inc
Tomasz Grysztar
Using the rare occasion of your presence I'd like to report, that the archive with the latest fasm version for Windows is incomplete.

_________________
Faith is a superposition of knowledge and fallacy
Post 09 Sep 2013, 21:30
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.