4.9.13 Ds Directive

The DS units directive reserves, but does not initialize, the specified amount of space. The single argument is the number of address units to be reserved. An address unit is determined by the flags used with the psect that holds the directive.

This directive is typically used to reserve bytes for RAM-based objects in the data memory (the enclosing psect's space flag set to 1). If the psect in which the directive resides is a bit psect (the psect's bit flag was set), the directive reserves the request number of bits. If used in a psect linked into the program memory, it will move the location counter, but not place anything in the HEX file output. Note that on Mid-range and Baseline devices, the size of an address unit in the program memory is 2 bytes (see 4.9.47.4 Delta Flag), so the DS pseudo-op will actually reserve words in that instance.

An object is typically defined by using a label and then the DS directive to reserve locations at the label location.

Examples:

PSECT myVars,space=1,class=BANK2
alabel:
  DS 23    ;reserve 23 bytes of memory
PSECT myBits,space=1,bit,class=COMRAM
xlabel:
  DS 2+3   ;reserve 5 bits of memory