flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
revolution 09 Sep 2009, 06:14
Because you have fixups enabled this makes your code section relocatable so then the value of $ is unknown at compile time. The macro needs a fixed value to work so any relocatable value will create the problem you see.
Instead try something like this: Code: display_decimal rva $ |
|||
![]() |
|
LocoDelAssembly 09 Sep 2009, 06:20
Well, it is OK that it doesn't compile because you are doing calculations over things that will change in run-time making the calculations wrong.
What I found strange is why it is reported so late, I would expect "digit=number/divisor" to be signaled as error, but instead fasm defers the error up to "if leading_zero...". [edit] Alternate solution: replace "number=value" with this: Code: virtual dq value load number qword from $$ end virtual But take in mind that if you pass addresses then the displayed values may or may not match those at run-time. rva shows the run-time relative virtual address but since it is relative you will have to add the run-time $$ to make them real full addresses. [/edit] |
|||
![]() |
|
hopcode 09 Sep 2009, 07:47
revolution wrote: Because you have fixups enabled this makes your code section relocatable... when first declaring (WYSIWYG) "format PE GUI 4.0 DLL" Quote: The macro needs a fixed value to work... and it should be so after all,shouldnt it ? |
|||
![]() |
|
revolution 09 Sep 2009, 07:54
hopcode wrote:
If you leave out the .reloc section then the OS has no choice but to load it at 0x400000, thus the value of $ is known with 100% certainty and the macro will work fine. |
|||
![]() |
|
hopcode 09 Sep 2009, 08:01
revolution wrote: ...but the OS can make it whatever it wants (by relocating... "format PE GUI 4.0 DLL". |
|||
![]() |
|
revolution 09 Sep 2009, 08:07
rva $ will give the offset from image base, that is always known whether fixups are enabled or not.
Image base is only a suggestion to the OS. fasm still makes it 0x400000 by default, just that now all absolute PC values become unknown because of fixups. With fixups you can only use relative PC values. |
|||
![]() |
|
hopcode 09 Sep 2009, 08:22
revolution wrote: ...With fixups you can only use relative PC values. Ok, ![]() Regards |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2023, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.