flat assembler
Message board for the users of flat assembler.
Index
> Macroinstructions > "virtual at (REG + VAR)" -- possible? |
Author |
|
Tomasz Grysztar 26 Jan 2004, 17:30
Adress for a "virtual" directive is a regular address expression (of the same type as the one you use inside the square brackets) and is calculated at the time when the "virtual" directive is processed.
Code: x = 4 virtual at ebx+x test1 dd ? end virtual x = 8 virtual at ebx+ecx*4+x test2 dd ? end virtual mov eax,[test1] ; it's mov eax,[ebx+4] mov eax,[test2] ; it's mov eax,[ebx+ecx*4+8] Numerical constants can be redefined (also in "if" clauses), but they cannot be forward-referenced in such case. |
|||
26 Jan 2004, 17:30 |
|
Frank 26 Jan 2004, 18:11
Privalov wrote: and is calculated at the time when the "virtual" directive is processed. Thank you for explanation and examples. Too bad, that was the "missing link" for a high-convenience, low-risk, fully automatic, framepointerless macro system. |
|||
26 Jan 2004, 18:11 |
|
Tomasz Grysztar 26 Jan 2004, 18:19
But you can achieve something near to what you're looking for by using symbolic constants, like:
Code: virtual at esp x dd ? x equ x+offs end virtual offs = 0 mov eax,[x] ; mov eax,[esp] offs = 8 mov eax,[x] ; mov eax,[esp+8] |
|||
26 Jan 2004, 18:19 |
|
aaro 26 Jan 2004, 20:40
|
|||
26 Jan 2004, 20:40 |
|
comrade 26 Jan 2004, 21:14
Why not make section of FASM site for such macro tricks? Kind of like 'assembly gems' but for FASM macros
|
|||
26 Jan 2004, 21:14 |
|
Tomasz Grysztar 26 Jan 2004, 21:19
This forum is a section of FASM site.
And it was made mainly for such 'gems' - most threads here contain some. |
|||
26 Jan 2004, 21:19 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.