flat assembler
Message board for the users of flat assembler.

 Index > Macroinstructions > Need Help on Macro Instruction
Author
3ric

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

{
forward

}

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
19 Dec 2013, 11:13
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
19 Dec 2013, 11:57
3ric

Joined: 19 Dec 2013
Posts: 14
3ric
thank you so much l_inc
19 Dec 2013, 12:16
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.
19 Dec 2013, 12:41
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
19 Dec 2013, 13:40
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First

 Jump to: Select a forum Official----------------AssemblyPeripheria General----------------MainTutorials and ExamplesDOSWindowsLinuxUnixMenuetOS Specific----------------MacroinstructionsOS ConstructionIDE DevelopmentProjects and IdeasNon-x86 architecturesHigh Level LanguagesProgramming Language DesignCompiler Internals Other----------------FeedbackHeapTest Area

Forum Rules:
 You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot vote in polls in this forumYou cannot attach files in this forumYou can download files in this forum