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.
MPASM Directive (links to explanatory section) | PIC Assembler Replacement |
---|---|
ACCESS_OVR | A psect with the
ovrld flag set |
__BADRAM and __BADROM | No replacement |
BANSISEL | The BANKISEL directive (no
change required) |
BANKSEL | The BANKSEL
directive (no change required) |
CBLOCK | Consider the
SET /EQU directives, or
DS . |
CODE | The code psect or
similar |
CODE_PACK | The code psect or
similar |
__CONFIG | The CONFIG
directive with appropriate settings and values |
CONFIG | The CONFIG
directive with appropriate settings and values |
CONSTANT | The EQU
directive |
DA | Consider the
DB or IRPC directives |
DATA | Consider the
DW directive |
DB | The DB
directive |
DE | Consider the
DB directive inside a suitable psect |
#DEFINE | The #define
preprocessor directive |
DT | The IRP
directive |
DTM | The IRP
directive |
DW | The DW or
DB directive |
ELSE | The ELSE
directive (no change required) |
END | The END
directive (no change required) |
ENDC | No replacement |
ENDM | The ENDM directive (no change required) |
ENDW | No replacement |
EQU | The EQU directive (no change required) |
ERROR | The ERROR directive |
ERRORLEVEL | Consider the -w driver option |
EXITM | No replacement |
EXPAND | The EXPAND directive (no change required) |
EXTERN | The EXTRN directive (note different spelling) |
FILL | Consider the --fill driver option |
GLOBAL | The GLOBAL directive (no change required) |
IDATA | A psect with the initial values in program memory and another reserving space for the data objects |
IDATA_ACS | A psect with the initial values in program memory and another reserving space for the data objects |
IF | The IF directive (no change required) |
IFDEF | Consider the #ifdef preprocessor directive |
IFNDEF | Consider the #ifndef preprocessor directive |
#INCLUDE | The #include preprocessor directive |
LIST | The LIST directive or consider alternate assembler options
|
LOCAL | The LOCAL directive (no change required) |
MACRO | The MACRO directive (no change required) |
__MAXRAM and __MAXROM | No replacement |
MESSG | The MESSG directive (no change required) |
NOEXPAND | The NOEXPAND directive (no change required) |
NOLIST | The NOLIST directive (no change required) |
ORG | Consider the ORG directive |
PAGE | No replacement |
PAGESEL | The PAGESEL directive (no change required) |
PAGESELW | Consider the PAGESEL directive |
PROCESSOR | The PROCESSOR directive (no change required) |
RADIX | The RADIX directive (no change required) |
RES | Consider the DS directive |
SET | The SET directive (no change required) |
SPACE | The SPACE directive (no change required) |
SUBTITLE | The SUBTITLE directive (no change required) |
TITLE | The TITLE directive (no change required) |
UDATA | The udata_bankn psect or similar |
UDATA_ACS | The udata_acs psect or similar |
UDATA_OVR | A psect with the ovrld flag set |
UDATA_SHR | A psect with the ovrld flag set |
#UNDEFINE | The #undefine preprocessor directive |
VARIABLE | Consider the SET directive |
WHILE | Consider the REPT directive |