The ORG statement alters the location counter for the
current segment and sets a new origin for
subsequent statements. The expression must be a simple
relocatable expression with no forward references. Only absolute
addresses or symbol values in the current segment may be used. The dollar-sign
character ('$'), which represents the current value of the location
counter, may be used in the expression.
When the ORG statement is encountered, the assembler
calculates the value of the expression and changes the
location counter.
If the ORG statement appears in an absolute segment, the location counter is
assigned the absolute address value specified. The location counter
may not be set to an address below the base address of the
segment.
If the ORG statement appears in a relocatable segment, the location counter
is assigned the offset of the specified expression. For
example, if the relocatable
segment starts at address 1000h and if the ORGexpression has a value of 1234h, the absolute address of the
next statement is 2234h (1000h + 1234h).
The ORG statement changes the location counter, which may
create a gap, but does not create a new segment.
It is possible to use the ORG statement to change the
location counter and overwrite (or overlay) existing code or data.
This is supported because of legacy programs that used this
technique to define multiple variables at the same physical
address. No warning is generated if the ORG statement is
used this way.
This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.
ARM websites use two types of cookie: (1) those that enable the site to function and perform as required; and (2) analytical cookies which anonymously track visitors only while using the site. If you are not happy with this use of these cookies please review our Privacy Policy to learn how they can be disabled. By disabling cookies some features of the site will not work.