4.16 Dt Directive
The MPASM DT
directive creates a table of
retlw
instructions.
Suggested Replacement
The PIC Assembler's IRP
directive inside a suitable
psect performs a similar task.
The IRP
directive works like a macro. The block of code
terminated by an ENDM
token is output once for each value specified
after the argument name. Any occurrence of the name argument inside the definition
is replaced with the value being processed.
You can use the data
psect to hold the values defined.
This psect is predefined once you include <xc.inc>
. For
example:
PSECT data
symbols:
IRP number,48,65h,6Fh
retlw number
ENDM
This would expand to:
PSECT data
symbols:
retlw 48
retlw 65h
retlw 6Fh
Alternatively, you can define your own psect and allocate it to program
memory. Ensure that the psect's space
flag is set to 0 (the default
value). It can be assigned an address by associating it with a suitable linker class
(e.g. CONST
for PIC18 devices, or STRCODE
for
other devices), or by explicitly positioning the psect using the linker's
-P
option (accessible from the driver using the
-Wl
option), as in the following PIC18 example.
PSECT romData,space=0,class=CONST
symbols:
IRP number,48,65h,6Fh
retlw number
ENDM