flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > Need Help on Macro Instruction

Author
Thread Post new topic Reply to topic
3ric



Joined: 19 Dec 2013
Posts: 14
3ric
i want to achieve something using macro in the following code

macro put .add,[val]
{
forward
MOV [EBP+.add],val

}


put 0x100, 0x12345678, 0x87654321, 0x34567812

so i want to get the these results

MOV [EBP+0x100],0x12345678
MOV [EBP+0x104],0x87654321
MOV [EBP+0x108],0x34567812


i am unable to find out a way to increase offset value by 0x04 on every instruction.


plz help me guys
Post 19 Dec 2013, 11:13
View user's profile Send private message Reply with quote
l_inc



Joined: 23 Oct 2009
Posts: 881
l_inc
3ric
Code:
macro put offset,[val*]
{
        common local cntr
                cntr = offset
        forward
                mov dword[ebp+cntr],val
                cntr = cntr+4
}    

_________________
Faith is a superposition of knowledge and fallacy
Post 19 Dec 2013, 11:57
View user's profile Send private message Reply with quote
3ric



Joined: 19 Dec 2013
Posts: 14
3ric
thank you so much l_inc
Post 19 Dec 2013, 12:16
View user's profile Send private message Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr
3ric,

For extra flexibility it can be rewritten as follows:
Code:
macro put offset,[val*]
{
        common local delta
                delta = 0
        forward
                mov dword [ebp+offset+delta], val
                delta = delta+4
}    
Then you can use something like put eax*8+0x100, 0x12345678, 0x87654321, 0x34567812 too.
Post 19 Dec 2013, 12:41
View user's profile Send private message Reply with quote
l_inc



Joined: 23 Oct 2009
Posts: 881
l_inc
baldr wrote:
Then you can use something like ...

Good point. As always, however.

_________________
Faith is a superposition of knowledge and fallacy
Post 19 Dec 2013, 13:40
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.

Powered by rwasa.