4.9.12 Dlabs Directive

The DLABS directive must be used to reserve one or more bytes of memory at the specified linear address on those devices that support linear addressing. Typically, the directive is used to allocate memory for large objects that do not fit within one data bank and which must be accessed via linear addressing. The general form of the directive is:

DLABS memorySpace, address, bytes [,symbol]

The memorySpace argument is a number representing the linear memory space. This will be the same number as the banked data space. The address is the address at which the reservation will take place. This can be specified as either a linear or banked address. The 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.

Specifying a symbol allows you to access the reserved memory in your code. The symbol is automatically made globally accessible and is equated to the address specified in the directive in linear addressing form. For example, the symbol, foo, defined by the following directive:

DLABS 1,0x120,128,foo
will be assigned the linear address 0x20A0 and can be used in code, for example:
    movlw low(foo)
    movwf FSR1L
    movlw high(foo)
    movwf FSR1H

The memory space number is the same as the number specified with the space flag option to psects (see 4.9.47.18 Space Flag).

The linker reads this DLABS-related information from object files and ensures that the reserved addresses are not used for other memory placement.