ORG - Set Location Counter

Syntax
ORG <expression>

Synonym

None

Description

The ORG directive sets the location counter to the value specified by <expression>. Subsequent statements are assigned memory locations starting with the new location counter value. The <expression> must be absolute and may not contain any forward, undefined, or external references. The ORG directive generates an internal section, which is absolute (see the Sections chapter).

Example

See the following listing for an example where ORG sets the location counter.

Listing: Using ORG to set the location counter

      org   $2000
b1:   nop

b2:   rts

Viewing the following listing, you can see that the b1 label is located at address $2000 and label b2 is at address $2001.

Listing: Assembler output listing from the source code

 Abs. Rel.   Loc    Obj. code   Source line
 ---- ----   ------ ---------   -----------

    1    1                        ORG $2000

    2    2  a002000 01             b1: nop

    3    3  a002001 05             b2: rts
See also

Assembler directives: