flat assembler
Message board for the users of flat assembler.
Index
> Macroinstructions > align & struc |
Author |
|
Tomasz Grysztar 28 Mar 2004, 11:13
All these errors are to signalize, that fasm is not able to determine the value of $ (as it doesn't know what the value of ebx would be), and whether it is aligned on some boundary or not. But when you want just to align relatively to register base (assuming that this base will be also aligned correctly), you can use some trick like this:
Code: macro falign value { virtual inc byte [dword $] load addrimm from $-4 end virtual rb (value-1)-(addrimm+value-1) mod value } |
|||
28 Mar 2004, 11:13 |
|
S.T.A.S. 28 Mar 2004, 12:31
Privalov, thanks a lot!!
Hmm.. I guess this is not just "some trick", but some kind of magic beyond my mind |
|||
28 Mar 2004, 12:31 |
|
Tomasz Grysztar 28 Mar 2004, 12:36
It just generates some virtual instruction (in this case "inc byte") with the address operand forced to use 32-bit immediate, and then loads this immediate from the generated instruction code to get only the immediate part of the address (ignoring the register base). This address is then used instead of $ for alignment (the last line is the same as good old "align" macro from the fasm's docs, with "$" replaced by "addrimm").
|
|||
28 Mar 2004, 12:36 |
|
S.T.A.S. 28 Mar 2004, 15:55
Thanks again for detailed explanation!
Now I see: inc [ebx+disp32] & inc [disp32] - of cource, the last DWORD of opcode is the same in both cases.. It seems easy when I see HOW this works, but it's not so easy to INVENT such nice trick.. I guess with new "store" directive there'll be more magic in FASM |
|||
28 Mar 2004, 15:55 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.