flat assembler
Message board for the users of flat assembler.

Index > Main > "Calling" macros from assembly stage?

Thread Post new topic Reply to topic

Joined: 29 Dec 2005
Posts: 2465
Location: Bucharest, Romania
Borsuc 05 May 2006, 17:57
The title is vague, I know. Smile

Say I have:
macro mov p1*, p2*    
and let's suppose it has about 4KB of assembly-stage directives, etc.

Now if I invoke this instruction 50,000 times, it will be SLOW and will take up very much memory at the assembly stage, because it will be replaced with the macro's definition and it will be 'repeating' the same thing 50,000 times.

What I want is, instead of 'duplicating' things over and over again, why not 'call' a piece of assembly-stage code and use that thing for all invocations? Just like calling procedures, instead of inlining them.

I know the 'macros' are in the preprocessor stage, but this 'call' directive or whatever should be part of the 'assembly-stage'. That is, it should be used to call a piece of assembly directive.

Example of usage:

macro mov p1*, p2*
  fasm_call mov_call p1, p2

fasm_call_label mov_call p1, p2
  if p1 > p2  ; just a silly thing
   ; ...
   ; ... some more assembly-stage directives
  end if
end fasm_call_label    

Okay, this was only an example to see my point. I know it's an extremely silly syntax. In my example "fasm_call_label" is the directive which declares those 'assembly-stage' labels, just like "proc" does with run-time procedures.

In fact, I don't really need such a directive or other similar things. I just need to 'call' or use the same piece of 'assembly-stage' code for multiple invocations, rather than 'duplicate' them in each case like macros would. If this is already possible, PLEASE TELL ME and forget about this post. PLEASE, if it's possible, pls tell me Smile skip the next paragraph if it's already possible.

If there's really no other way, and you need to implement such a directive, let me know. I know you're busy with the doc and all that, and I understand there's no rush, but at least PLEASE tell me if you are planning to add such a directive or not. It would be nice if I knew what plans are for such a directive. I'm sorry for such silly suggestions again, but I just hate things that duplicate themselves MANY times. And it hurts my memory too Wink

Previously known as The_Grey_Beast
Post 05 May 2006, 17:57
View user's profile Send private message Reply with quote
Tomasz Grysztar

Joined: 16 Jun 2003
Posts: 8346
Location: Kraków, Poland
Tomasz Grysztar 05 May 2006, 19:23
My answer may be slightly changing the topic, but I really consider writing someday a "fasm 2.0" where the preprocessor and assembler would be a one layer and one language. Yeah, it wouldn't be much backward-compatible, it would be slower, but certainly it would be much more powerful and easy to use.
Post 05 May 2006, 19:23
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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.