4 Assembler Directives

Some MPASM assembler directives have equivalents in the MPLAB XC8 PIC Assembler; however, other MPASM directives must be adapted to a new syntax or replaced with an alternate sequence of directives.

The following table shows each MPASM directive and the best PIC Assembler equivalent. These directives and their equivalents are discussed in more detail in the sections that follow. Note that there can be subtle differences in the behavior of what appear to be identical directives, and this could lead to unexpected program behavior. It is recommended that you compare the directive description in the MPLAB® XC8 PIC Assembler User's Guide with that in your MPASM documentation to ensure that your migrated code will work as expected in all situations.

Table 4-1. Equivalent PIC Assembler Directives
MPASM Directive

(links to explanatory section)

PIC Assembler Replacement
ACCESS_OVRA psect with the ovrld flag set
__BADRAM and __BADROMNo replacement
BANSISELThe BANKISEL directive (no change required)
BANKSELThe BANKSEL directive (no change required)
CBLOCKConsider the SET/EQU directives, or DS.
CODEThe code psect or similar
CODE_PACKThe code psect or similar
__CONFIGThe CONFIG directive with appropriate settings and values
CONFIGThe CONFIG directive with appropriate settings and values
CONSTANTThe EQU directive
DAConsider the DB or IRPC directives
DATAConsider the DW directive
DBThe DB directive
DEConsider the DB directive inside a suitable psect
#DEFINEThe #define preprocessor directive
DTThe IRP directive
DTMThe IRP directive
DWThe DW or DB directive
ELSEThe ELSE directive (no change required)
ENDThe END directive (no change required)
ENDCNo replacement
ENDMThe ENDM directive (no change required)
ENDWNo replacement
EQUThe EQU directive (no change required)
ERRORThe ERROR directive
ERRORLEVELConsider the -w driver option
EXITMNo replacement
EXPANDThe EXPAND directive (no change required)
EXTERNThe EXTRN directive (note different spelling)
FILLConsider the --fill driver option
GLOBALThe GLOBAL directive (no change required)
IDATAA psect with the initial values in program memory and another reserving space for the data objects
IDATA_ACSA psect with the initial values in program memory and another reserving space for the data objects
IFThe IF directive (no change required)
IFDEFConsider the #ifdef preprocessor directive
IFNDEFConsider the #ifndef preprocessor directive
#INCLUDEThe #include preprocessor directive
LISTThe LIST directive or consider alternate assembler options
LOCALThe LOCAL directive (no change required)
MACROThe MACRO directive (no change required)
__MAXRAM and __MAXROMNo replacement
MESSGThe MESSG directive (no change required)
NOEXPANDThe NOEXPAND directive (no change required)
NOLISTThe NOLIST directive (no change required)
ORGConsider the ORG directive
PAGENo replacement
PAGESELThe PAGESEL directive (no change required)
PAGESELWConsider the PAGESEL directive
PROCESSORThe PROCESSOR directive (no change required)
RADIXThe RADIX directive (no change required)
RESConsider the DS directive
SETThe SET directive (no change required)
SPACEThe SPACE directive (no change required)
SUBTITLEThe SUBTITLE directive (no change required)
TITLEThe TITLE directive (no change required)
UDATAThe udata_bankn psect or similar
UDATA_ACSThe udata_acs psect or similar
UDATA_OVRA psect with the ovrld flag set
UDATA_SHRA psect with the ovrld flag set
#UNDEFINEThe #undefine preprocessor directive
VARIABLEConsider the SET directive
WHILEConsider the REPT directive