4.51 Res Directive
The MPASM RES
directive reserves memory by advancing the
location counter.
Suggested Replacement
The PIC Assembler's DS
directive has a similar
function, but there are some differences in its operation.
DS
directive advances the location counter,
allowing memory to be allocated to a label defined before the directive. Typically
it is used inside psects linked to the data space, providing a mechanism to reserve
memory for variables, as in the following
example.PSECT udata_bank0
input:
DS 2 ;allocate 2 bytes for input
output:
DS 4 ;allocate 4 bytes for output
If the directive is used in a psect assigned to program memory
(space=0
flag), it will move the location counter, but not
place anything in the HEX file output.
The address units of this directive are determined by context, in
particular, the delta
and bit
flag values
associated with the psect in which it resides. If the delta
flag is
set to 1, then the directive moves the location counter forward by the specified
number of bytes; if it is 2, it moves it forward by 16-bit words, etc. When the
bit
flag is used, the allocation units are bits.