flat assembler
Message board for the users of flat assembler.
Index
> Macroinstructions > Fasm 1 macro fill data. |
Author |
|
revolution 20 Dec 2019, 11:16
Perhaps something like this:
Code: macro Fill address,[value] { common local i i = 0 Mov eax, address forward Mov dword[eax + i], value i = i + 4 } |
|||
20 Dec 2019, 11:16 |
|
Roman 20 Dec 2019, 11:26
Super puper
Thanks. |
|||
20 Dec 2019, 11:26 |
|
ProMiNick 20 Dec 2019, 13:58
above variant not able to fill values from memory (only imm or reg) because of absence mov mem to mem instruction.
but push memory exists macro FillByPush address, size, [value] { common mov eax, address add eax,size-4 xchg eax, esp reverse push value common xchg esp, eax ; if restoring eax significant| or just mov esp, eax add eax, 4 ; if restoring eax significant } but it require to precede its values by size in large structures my variant is significantly shorter & faster, and structures size is something predefined. |
|||
20 Dec 2019, 13:58 |
|
revolution 20 Dec 2019, 14:13
ProMiNick wrote: above variant not able to fill values from memory (only imm or reg) because of absence mov mem to mem instruction. Code: mov eax, address + size - 4 |
|||
20 Dec 2019, 14:13 |
|
DimonSoft 20 Dec 2019, 18:47
Changing ESP to point to arbitrary places gets program into trouble almost definitely: Why do we even need to define a red zone? Can’t I just use my stack for anything?
|
|||
20 Dec 2019, 18:47 |
|
ProMiNick 20 Dec 2019, 22:18
Using stack for struct initialization (taken by me from reversing OOPs hardcoded internals) is always simpler, shorter and faster, but yes it is applicable only for protected mode with multiple stacks implemented.
But I test it even more limited - OOP use pushes to initialize object located in heap, not in stack. I test this technic only in heap too! |
|||
20 Dec 2019, 22:18 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.