flat assembler
Message board for the users of flat assembler.
Index
> Main > How to use align directive? |
Author |
|
Tomasz Grysztar 23 Mar 2004, 19:34
Yes, the "org" affects "align", as the alignment is always done relative to $ address, which is affected by "org" - the alignment is done for the address in memory, not the pointer in file. Also "align" works only with powers of two, if you need some other alignments, use the old alignment macros.
|
|||
23 Mar 2004, 19:34 |
|
LiuJunfeng 23 Mar 2004, 22:50
I find that
Code: rb offset_to_align - $ But since $ is relative to org, what if I want to get the absolute offset? Last edited by LiuJunfeng on 24 Mar 2004, 12:41; edited 1 time in total |
|||
23 Mar 2004, 22:50 |
|
Tomasz Grysztar 23 Mar 2004, 22:54
What do you mean by "absolute offset"?
|
|||
23 Mar 2004, 22:54 |
|
LiuJunfeng 24 Mar 2004, 03:44
If you don't use any org directive, then $'s value equal to "absolute offset".
If many org directives are used, then $'s value is relative. |
|||
24 Mar 2004, 03:44 |
|
JohnFound 24 Mar 2004, 05:19
Hi Liu. The word "relative" have several meanings in English language.
Quote: Yes, the "org" affects "align", as the alignment is always done relative to $ address Privalov used it in the meaning: "Align changes the $ value and org changes this value too." "org" directive simply changes the value of "$" internal variable. "align" also changes the value of "$" internal variable, but in another manner. Regards. |
|||
24 Mar 2004, 05:19 |
|
Tomasz Grysztar 24 Mar 2004, 10:30
To be more precise: "org" directive does not change value of "$" directly, it changes the addressing origin, which is used to calculate "$" - which is always obtained by substracting that origin from the current pointer in output code. And "align", like any instruction coded or data directives, put some new bytes into output, therefore modifying the current pointer, but not the addressing origin, which can be altered only with "org". And as the numer of byte that "align" puts into the output is dependent on the "$" value (as the "align" pads current pointer up to the nearest aligned "$" value), it's this way dependent on the addessing origin, too.
|
|||
24 Mar 2004, 10:30 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.