EasyManua.ls Logo

ST ST7 - Symbol Definition

ST ST7
317 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
141/317
6 - STMicroelectronics Programming Tools
wish to build a table of jump addresses, you must use this order to make the jumps occur as
expected.
On the other hand, a
CALL instruction pushes the return address Most Significant Byte first,
which means that in memory the Most Significant Byte is stored at a higher address than the
Least Significant Byte that is stored next. If you wish to write a subroutine that compares the
return address, as found in the stack, with a constant address stored in memory (for example
to identify the caller of the subroutine), you must store the constant address Least Significant
Byte first.
To allow for both cases, two sets of pseudo-ops are available:
The pseudo-ops
DC.B, DC.W and DC.L put the Most Significant Byte first.
The pseudo-ops
BYTE, WORD and LONG put the Least Significant Byte first.
Actually,
DC.B and BYTE are equivalent, since only one byte comes into play.
The
STRING pseudo-op is primarily used to define character strings, but actually any sequence
of bytes can be defined with it:
Message: STRING "Hello"; this message is the same as the following:
Message2: STRING 48h, 45h, 4Ch, 4Ch, 4Fh
6.1.4.2 Symbol definition
Symbols are like constant data, in that they are defined in the source text, and they cannot be
changed by program execution. The difference is, that constant data uses up bytes in memory
for storage while symbols have values at assembly time but these values do not remain in
memory at execution time. Symbols are especially useful, however, for generating constant
data.
Syntax: a symbolic value is defined using the pseudo-op EQU. Example:
A_DOZEN EQU 12
From this time on, the word A_Dozen can be used anywhere the number 12 would be appro-
priate. This is useful if a value is used in several different parts of a program, but may change
if the program is revised to take account of a hardware change. For example, a program that
displays characters on a liquid-crystal display must know at various points, the number of
characters that the display is able to show:
DISPLAY_WIDTH EQU 16

Table of Contents

Related product manuals