flat assembler
Message board for the users of flat assembler.
Index
> Compiler Internals > Why get_relative_offset won't cooperate? |
Author |
|
beppe85 09 Feb 2005, 07:11
Hi, people!
I'm trying to get a relative offset for an operand. I can get absolute address with get_dword_value, that works okay even with forward references. But how could I get the current PC? Privalov, can you also explain the next_pass_needed symbol? I mean, what can set it to TRUE, and when we need to bother with it, when parsing an instruction. Thanks in advance. _________________ "I assemble, therefore I am" If you got some spare time, visit my blog: http://www.beppe.theblog.com.br/ and sign my guestmap |
|||
09 Feb 2005, 07:11 |
|
Tomasz Grysztar 09 Feb 2005, 11:48
get_relative_offset calculates the (address-$) value, it does it by adding the $ and substraction operation symbols at the end of expression calculation (the fasm's expression calculator works in RPN). The value of $ symbol itself is calculated internally by expression calculator at "current_offset_label" and it does it by substracting the 64-bit [org_origin] variable from the current code generation pointer, zero-extended to 64 bits.
When writing an instruction handler, you usually don't have to bother with [next_pass_needed] variable, the routines like "get_dword_value" do it for you. However I already posted once the detailed description of how fasm determines when the next pass is needed, look here: http://board.flatassembler.net/topic.php?t=1774 |
|||
09 Feb 2005, 11:48 |
|
beppe85 09 Feb 2005, 18:12
Very thank you! I'll re-read how jmp/jcc are implemented to see what I made wrong.
And I'll read the link you have passed, I think it would be very instructive. _________________ "I assemble, therefore I am" If you got some spare time, visit my blog: http://www.beppe.theblog.com.br/ and sign my guestmap |
|||
09 Feb 2005, 18:12 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.