162/317
6 - STMicroelectronics Programming Tools
117
0033
#IFLAB
3
117
0033
A603
ld
A, #3
; 1st arg is constant
117
0035
#ENDIF
117
0035
#IFLAB
NbOfApples
117
0035
BB02
add
A, NbOfApples
117
0037
#ELSE
117
0037
B704
ld
NbOfFruit, A
6.1.8 Some miscellaneous features
Here are a few pseudo-ops or controls that help writing and assembling code.
6.1.8.1 EQU and CEQU pseudo-ops
The
EQU
pseudo-op has already been mentioned. Both
EQU
and
CEQU
work pretty much the
same way; however,
EQU
assigns a value to an identifier that cannot be changed later, other-
wise the assembler would produce an error. The pseudo-op
CEQU
, on the contrary, allows an
identifier to be set to various values all along the program. This can be useful in writing macros
or in conjunction with conditional statements. The identifier defined has the same properties
as a label and can be used anywhere a label is used. Example:
d2A
EQU
{d2 + $100}
Be careful with the syntax of expressions. They always must be enclosed in curly braces.
Please refer to the ST7 Software Tools Manual for more details. The identifier on the left of the
EQU
statement, being a label, must start on the first character of the line. As a label, it has a
size that is derived from the current default (
BYTES
,
WORDS
or
LONGS
) or that can be specified
using a modifier like:
d2A.b
EQU
{d2 + $10}
6.1.8.2 #DEFINE pseudo-op
The #DEFINE pseudo-op gives an identifier a value that is a character string. Examples:
#DEFINE THREE 3
#DEFINE RESULT NumberOfApples
This being a pseudo-op, it must not start on the first character of the line. Apparently, this
seems no different from the
EQU
pseudo-op. Actually, it is very different in that the identifier is
not a label. It is more like a macro, that instead of a group of lines is associated with a word (in
the literary sense: a string of characters). S o, each time the identifier
THREE
of the example
Содержание ST7 Series
Страница 1: ...ST7 8 BIT MCU FAMILY USER GUIDE JANUARY 1999 1 ...
Страница 238: ...238 317 8 C Language and the C Compiler 08 Burn bmp Then use the EPROMer programmer software as described in Chapter 7 ...
Страница 289: ...289 317 10 Second Application a Sailing Computer 10 befor Bs Rw Vw VMG AlphaR AlphaV Before the wind ...