4.45 Org Directive

The MPASM ORG directive sets the initial location counter for subsequent code to be the specified address.

Suggested Replacement

The PIC Assembler's ORG directive performs a similar task to this directive, but there are some differences in its operation.

The ORG directive changes the value of the location counter within the current psect to be that specified. This means that the address set by the ORG directive is relative to the base address of the psect, which is typically not determined until link time. For example, using ORG 0100h inside a psect that is ultimately linked to address 0x2000 will move the location counter to address 0x2100. Only if the psect in which this directive is placed is absolute (uses the abs flag) and overlaid (ovrld flag) will the location counter be moved to the absolute address specified.

The ORG directive is seldom needed in programs. To have code or data located at a particular address, place it in a unique psect and have the linker position that psect at the required location.