Assembler

#IF expression: The start of a conditional assembly structure expression is an arithmetic expression that can contain symbols. Caution: since conditional assembly is resolved during the first pass of the assembler, no forward referenced symbols should be used in a conditional assembly expression. If an expression is TRUE (non zero), then the lines following this directive are assembled until a #ELSE or a #ENDIF directive is encountered. If an expression is FALSE (equal to zero), then all input lines are skipped until a #ELSE or a #ENDIF directive is encountered. If a #ELSE directive is encountered first, all lines following it are assembled, until a #ENDIF directive is found.

Example:

#IF expression

;do something here

#ELSE

;do other things here

#ENDIF

#IFDEF symbol: Start of a conditional assembly structure. If the symbol has been defined (either with a #DEFINE directive or an EQU directive) then the lines following this directive are assembled until a #ELSE or a #ENDIF directive are encountered. If symbol has not been defined, then all input lines are skipped until a #ELSE or a #ENDIF directive is encountered. If a #ELSE directive is encountered first, all lines following it are assembled, until a #ENDIF directive is found.

#IFNDEF: Start of a conditional assembly structure. If symbol has NOT been defined then the lines following this directive are assembled until a #ELSE or a #ENDIF directive is encountered. If symbol has been defined (either with a #DEFINE directive or an EQU directive), then all input lines are skipped until a #ELSE or a #ENDIF directive are encountered. If a #ELSE directive is encountered first, all lines following it are assembled, until a #ENDIF directive is found.

Code Development Tools

5-13

Page 309
Image 309
Texas Instruments MSP50C6xx manual #IF expression Do something here, #Else, Do other things here, #Endif