 |
A166 User's Guide |
 |
|
|
|
|
ORG Assembler Statement
| Arguments |
ORG expression
|
| Description |
The ORG statement alters the location counter for the
current section 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 section 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 section, 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
section.
-
If the ORG statement appears in a relocatable section, the location counter
is assigned the offset of the specified expression. For
example, if the relocatable
section starts at address 1000h and if the ORG
expression 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 section.
-
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.
|
| See Also | SECTION |
| Example |
ORG 100h
ORG RESTART
ORG EXIT1
ORG ($ + 15) AND 0FFF0h
|
|
|
|