flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > [REQUEST] Default macro/struc parameters.

Author
Thread Post new topic Reply to topic
bitRAKE



Joined: 21 Jul 2003
Posts: 3018
Location: vpcmipstrm
bitRAKE
Code:
macro dummy [a] {}
struc temp0 x,y,z {
    dummy .
     .a dd z
     .b dd y
     .c dq z
     .. = $ - .a
}
struc temp1 x,y,z {
   dummy .
     .a temp0 x
  .b dq y
     .c dq z
     .. = $ - .a.a
}


virtual
  .abc temp1 <?,?,?>,?,?
end virtual    
The present syntax requires full topology expression at invocation, or assembly-time checking. It would more convenient (imho) to allow default values for parameters at the preprocessor level.
Code:
macro dummy [a] {}
struc temp0 x=?,y=?,z=? {
    dummy .
     .a dd z
     .b dd y
     .c dq z
     .. = $ - .a
}
struc temp1 x=?,y=?,z=? {
     dummy .
     .a temp0 x
  .b dq y
     .c dq z
     .. = $ - .a.a
}


virtual
  .abc temp1
end virtual    
The amount of code required for this feature seems small since the preprocessor is already checking for "*". (Maybe a couple dozen lines - still working out the details.) AFAIK, it wouldn't interfere with present features/code.

Of course, the struct macros provide some of the functionality. Yet, there are workarounds being used because of lacking default parameters. For example, the "parm+0" for numerical values. Listings would look more "tidy" , imho.

_________________
¯\(°_o)/¯ unlicense.org
Post 01 Sep 2010, 03:03
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7781
Location: Kraków, Poland
Tomasz Grysztar
Sound like a nice extension. Would need a bit of code for processing definitions like "x=<y,z>,y,z", so I may not have it ready in quarter hour. Wink But when I have some free evening...
Post 01 Sep 2010, 07:00
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.