158/317
6 - STMicroelectronics Programming Tools
nition of the macro is:
IncByTwo
MACRO TheByte
inc TheByte
inc TheByte
MEND
The macro is used by adding the symbol of the byte to be incremented:
IncByTwo CounterLo
The macro is expanded by the assembler to the following code:
44
IncByTwo CounterLo
44
000F
3C00
inc
CounterLo
44
0011
3C00
inc
CounterLo
Two or more arguments may be used. The following macro adds two variables and puts the
result in a third variable. The definition of the macro is:
Addition
MACRO VarA, VarB, Result
ld A, VarA
add A, VarB
ld Result, A
MEND
The macro is used by typing the names of the symbols to be added and that of the result:
Addition NbOfApples, NbOfPears, NbOfFruit
The macro is expanded by the assembler into the following code:
57
Addition NbOfApples, NbOfPears,
NbOfFruit
57
0013
B602
ld
A, NbOfApples
57
0015
BB03
add
A, NbOfPears
57
0017
B704
ld
NbOfFruit, A
6.1.7.2 Local symbols
You can insert statements that define symbols inside a macro, or labels in front of some oper-
ations. However, this can lead to problems. Let us consider the following macro that incre-
Содержание 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 ...