Microchip Technology XC8 Standard Compiler (Workstation) SW006021-1 SW006021-1 User Manual

Product codes
SW006021-1
Page of 518
Macro Assembler
 2012 Microchip Technology Inc.
DS52053B-page 259
6.4.9.4
 ORG
The ORG directive changes the value of the location counter within the current psect. 
This means that the addresses set with ORG are relative to the base address of the 
psect, which is not determined until link time.
The argument to ORG must be either an absolute value, or a value referencing the cur-
rent psect. In either case the current location counter is set to the value determined by 
the argument. It is not possible to move the location counter backward. For example:
ORG 100h
will move the location counter to the beginning of the current psect plus 100h. The 
actual location will not be known until link time.
In order to use the ORG directive to set the location counter to an absolute value, the 
directive must be used from within an absolute, overlaid psect. For example:
PSECT absdata,abs,ovrld
    ORG 50h
  ;this is guaranteed to reside at address 50h
6.4.9.5
EQU
This pseudo-op defines a symbol and equates its value to an expression. For example
thomas EQU 123h
The identifier thomas will be given the value 123h. EQU is legal only when the symbol 
has not previously been defined. See also Section 6.4.9.6 “SET” which allows for 
redefinition of values.
This directive performs a similar function to the preprocessor’s #define directive, see 
Section 5.14.1 “C Language Comments”.
6.4.9.6
SET
This pseudo-op is equivalent to EQU (Section 6.4.9.5 “EQU”) except that allows a 
symbol to be re-defined without error. For example:
thomas SET 0h
This directive performs a similar function to the preprocessor’s #define directive, see 
Section 5.14.1 “C Language Comments”.
Note:
The much-abused ORG directive does not move the location counter to the 
absolute address you specify. Only if the psect in which this directive is 
placed is absolute and overlaid will the location counter be moved to the 
address specified. To place objects at a particular address, place them in a 
psect of their own and link this at the required address using the linkers -P 
option, see Section 7.2.19 “-Pspec”. The ORG directive is not commonly 
required in programs.