flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > MACRO's name which becomes the result

Author
Thread Post new topic Reply to topic
AsmER



Joined: 25 Mar 2006
Posts: 64
Location: England
AsmER 29 Dec 2006, 23:08
Hi,
Is it possible to write a macro which will be exchanged with its result (calculated value) everytime it is executed in the code? To make it clearer, something like:
Code:
macro SQUARE value
{
  result = value * value;
}
...
mov eax, SQUARE 5
...
    


Any ideas? thanks

_________________
;\\ http://theasmer.spaces.live.com \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
Post 29 Dec 2006, 23:08
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20355
Location: In your JS exploiting you and your system
revolution 30 Dec 2006, 00:19
Short answer: No
Long Answer: Yes, but you (or someone else) will have to modify/reprogram fasm, else without modification/reprogramming, No

Inline macros have been discussed before. Perhaps someone knows where the old topics are and can post a link?
Post 30 Dec 2006, 00:19
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8356
Location: Kraków, Poland
Tomasz Grysztar 30 Dec 2006, 00:39
The very recent topic (just two rows below in this forum) contains a link to one of those old ones: http://board.flatassembler.net/topic.php?t=6437
Post 30 Dec 2006, 00:39
View user's profile Send private message Visit poster's website Reply with quote
AsmER



Joined: 25 Mar 2006
Posts: 64
Location: England
AsmER 30 Dec 2006, 12:40
OK, then I'll try to find some other way. Probably something like this will do:

Code:
macro SQUARE rn*, v*
{
 MRV#rn = v*v
}
...
; and then
SQUARE 1, 10
mov eax, MRV1
    


Anyway thanks for the answer.

_________________
;\\ http://theasmer.spaces.live.com \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
Post 30 Dec 2006, 12:40
View user's profile Send private message Reply with quote
jbojarczuk



Joined: 21 Jun 2006
Posts: 27
jbojarczuk 14 Jan 2007, 21:02
Well, you could use a C preprocessor...

If you have a C compiler, check if it has any options on preprocessing only. If it does, you could use it to generate a file, and then send this file to fasm.

It is kind of a long shot, but if you automate you compilation, it might give you the flexibility you are looking for...
Post 14 Jan 2007, 21:02
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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.