flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > Nesting macros containing locals in an irps causes an error

Thread Post new topic Reply to topic

Joined: 19 Nov 2009
Posts: 1216
Location: NC, USA
Tyler 05 Apr 2010, 05:15
Dude, you're freakin' kidding me!!! Evil or Very Mad I spent SSOOO long pondering that one problem, I haven't finished anything today. The funny thing is, I also didn't escape the {}s the first few times, but I'd seen that done so many times, I eventually noticed it. Thanks, I'm using it for a conditional mov and call(not together), here's the code after I added \s
irps cond, a b e z na nb ne nz
   macro mov#cond dst*,src*,else_src
      if cond eq
         mov dst,src
         \local .cond_met
         \local .cond_unmet
         j#cond .cond_met
         if ~(else_src eq )
            mov dst,else_src
         end if
         jmp .cond_unmet
         mov dst,src
      end if

     macro call#cond location ; Wasn't sure if I could use label
      \local true
      \local false
      j#cond true
      jmp false
      call location

The actual jumps are really bad style, but it'll simplify my code 100 fold.
Post 05 Apr 2010, 05:15
View user's profile Send private message Reply with quote
When all else fails, read the source

Joined: 24 Aug 2004
Posts: 18960
Location: In your JS exploiting you and your system
revolution 05 Apr 2010, 06:34
I use this little cmov macro for when I need to support older CPUs
irp cc,a,ae,b,be,c,e,g,ge,l,le,na,nae,nb,nbe,nc,ne,ng,nge,nl,nle,no,np,ns,nz,o,p,pe,po,s,z {
     local i
     macro cmov#cc [args] \{
            \local .x
              j#cc    .x
          load    i from $-2
          store   (i xor 1) at $-2
            mov     args
It shows the use of both escaped and unescaped local. Note that the other preprocessor strings need escaping also: common, forward, reverse,`, #, }.
Post 05 Apr 2010, 06:34
View user's profile Send private message Visit poster's website 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 GitHub, YouTube, Twitter.

Website powered by rwasa.