User manual
ST Assembler-Linker Assembler directives
Doc ID 11392 Rev 4 59/89
Description
The benefits of using labels in assembler level programming are obvious and well
known. Sometimes, though, values other than the straight numerics allowed in labels
are used repeatedly in programs and are ideal candidates for special labelling.
The #DEFINE directive allows you to define special labels called 'manifest constants'.
These are basically labels that contain strings instead of numeric constants. During
the assembly, wherever a manifest ID is found in the source code, it is replaced by its
real argument before the assembly proceeds. The #DEFINE is not the definition of a
label, so a space must precede the declaration.
The number of defines that the Assembler can manage is limited to 4096. However,
this depends on the number of characters in the statements. Depending on their
length, you may reach this limit sooner.
Example
#define value 5
ld a,#value ; ld a,#5
See also
Table 30. DS.B
Purpose Define byte space in object code.
Format DS.B [optional number of bytes]
Description
This directive is used to 'space out' label definitions. For example let's say we need a
set of byte-sized temporary storage locations to be defined in RAM, starting at
address $4000. We could write:
segment byte at 4000 'RAM'
temp1 equ $4000
temp2 equ $4001
which would work fine, however, we recommend you to write:
segment byte at 4000 'RAM'
temp1 DS.B
temp2 DS.B
which does the same job. The advantage is that the PC increments automatically.
There are two other types of DS instructions available for doing WORD and LONG
length storage areas: DS.W and DS.L. Note that the areas in question are not
initialized to any value; it's merely a way of allocating values to labels.
The optional argument specifies how many bytes to allocate; the default is 1.
Because no code is generated to fill the space, you are not allowed to use DS.B in
segments containing code, only for segments with data definitions.
Example labl DS.B
See also DS.W, DS.L
Table 31. DS.W
Purpose Define word space in object code.
Format DS.W [optional number of words]
Table 29. #DEFINE