161/317
6 - STMicroelectronics Programming Tools
95
001F
B602
ld
A, NbOfApples
95
0021
BB03
add
A, NbOfPears
95
0023
#IFB
NbOfFruit
95
0023
B704
ld
NbOfFruit, A ; result in third argument
95
0025
#ENDIF
96
0025
97
98
Addition NbOfApples, NbOfFruit,
98
0025
B602
ld
A, NbOfApples
98
0027
BB04
add
A, NbOfFruit
98
0029
#IFB
98
0029
B704
ld
NbOfFruit, A ; result in second argument
98
002B
#ELSE
#IFLAB <identifier> Conditional.
This conditional tests whether an argument is a label. This may be used to distinguish be-
tween a label and a constant. For example, let us consider again the addition m acro, but
changed so that the first two arguments may be at will either labels or constants. The third ar-
gument must be a label. The macro is:
AddFlex
MACRO argA, argB, Result
#IFLAB argA
ld A, argA
#ELSE
ld A, #argA
; 1st arg is constant
#ENDIF
#IFLAB argB
add A, argB
#ELSE
add A, #argB
; 2nd arg is constant
#ENDIF
ld Result, A
MEND
We see that according to whether the argument is a label or not , a different addressing mode
is used (extended or immediate). Here are two expansions with different arrangements of ar-
guments:
115
AddFlex
NbOfApples, 3, NbOfFruit
115
002D
#IFLAB
NbOfApples
115
002D
B602
ld
A, NbOfApples
115
002F
#ELSE
115
002F
#IFLAB
3
115
002F
AB03
add
A, #3
; 2nd arg is constant
115
0031
#ENDIF
115
0031
B704
ld
NbOfFruit, A
116
0033
117
AddFlex
3, NbOfApples, NbOfFruit
Содержание 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 ...