6.1.9.8 Dabs Directive
The DABS
directive allows one or more bytes of memory to
be reserved at the specified address. The general form of the directive is:
DABS memorySpace, address, bytes [,symbol]
where memorySpace
is a number
representing the memory space in which the reservation will take place,
address
is the address at which the reservation
will take place and bytes
is the number of bytes that is
to be reserved. The symbol is optional and refers to the name of the object at the
address.
foo
, defined by the
following directive:DABS 1,0x100,4,foo
can be used
in code, for example: movlw 20
movwf BANKMASK(foo)
BANKMASK()
or PAGEMASK()
macros or ANDing the operand with a mask) is not necessary when using the
-Wl,--fixupoverflow
option and any of the
ignore
, warn
, or lstwarn
arguments.This directive differs to the DS
directive in that it can
be used to reserve memory at any location, not just within the current psect. Indeed, these
directives can be placed anywhere in the assembly code and do not contribute to the
currently selected psect in any way. Additionally, objects defined by the
DS
directive inside a psect are allocated free memory by the linker,
whereas the allocation address must be specified and manged by the programmer when using
the DABS
directive.
The memory space number is the same as the number specified with the
space
flag option to psects (see 6.1.9.39.18 Space Flag).
The linker reads this DABS
-related information from
object files and ensures that the reserved addresses are not used for other memory
placement.