flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > 'rept' bug?

Author
Thread Post new topic Reply to topic
quiveror



Joined: 20 Jun 2003
Posts: 34
quiveror
Code:
macro foo {
rept 4 n:0 \{ P#n equ 'hello' \}
}
foo
display P0,13,10
    

Should the above code print 'hello'? I got an error Sad
Post 29 Dec 2006, 08:20
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7734
Location: Kraków, Poland
Tomasz Grysztar
You forgot to escape the # operator. "P#n" becomes "Pn", while "P\#n" will do what you wanted.
Post 29 Dec 2006, 10:51
View user's profile Send private message Visit poster's website Reply with quote
quiveror



Joined: 20 Jun 2003
Posts: 34
quiveror
My bad, hehe Embarassed
Post 29 Dec 2006, 17:24
View user's profile Send private message Reply with quote
Picnic



Joined: 05 May 2007
Posts: 1288
Location: behind the arc
Picnic
Good day Assemblers,
Can you give me an example how to use rept in a case like below:
Code:
   img1 FILE 'img1.ico':22 
      img2 FILE 'img2.ico':22 
      img3 FILE 'img3.ico':22 
      img4 FILE 'img4.ico':22 
      img5 FILE 'img5.ico':22 
      img6 FILE 'img6.ico':22 
      img7 FILE 'img7.ico':22 
    
Post 01 Mar 2008, 11:14
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17332
Location: In your JS exploiting you and your system
revolution
I think this:
Code:
rept 7 x { img#x FILE 'img'#`x#'.ico':22 }    
Post 01 Mar 2008, 11:26
View user's profile Send private message Visit poster's website Reply with quote
Picnic



Joined: 05 May 2007
Posts: 1288
Location: behind the arc
Picnic
Yes it's working fine.
Now inside a macro how to use \ ?

Code:
   
     macro ImgData {
        rept 7 x \{ 
           img\#x FILE 'img'#`x#'.ico':22      ; error
           \}
        }
    

p.s thanks revolution


Last edited by Picnic on 01 Mar 2008, 13:25; edited 1 time in total
Post 01 Mar 2008, 13:05
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17332
Location: In your JS exploiting you and your system
revolution
Just escape all the operators # and `.
Code:
   
     macro ImgData {
        rept 7 x \{ 
           img\#x FILE 'img'\#\`x\#'.ico':22      ; error
           \}
        }
    
Post 01 Mar 2008, 13:23
View user's profile Send private message Visit poster's website Reply with quote
Picnic



Joined: 05 May 2007
Posts: 1288
Location: behind the arc
Picnic
oh, i see now revolution, thanks for your time Smile
Post 01 Mar 2008, 14:15
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.