SPNU118Z September 1995 – March 2023 66AK2E05 , 66AK2H06 , 66AK2H12 , 66AK2H14 , AM1705 , AM1707 , AM1802 , AM1806 , AM1808 , AM1810 , AM5K2E04 , OMAP-L132 , OMAP-L137 , OMAP-L138 , SM470R1B1M-HT , TMS470R1A288 , TMS470R1A384 , TMS470R1A64 , TMS470R1B1M , TMS470R1B512 , TMS470R1B768
The following built-in substitution symbol functions enable you to make decisions on the basis of the string value of substitution symbols. These functions always return a value, and they can be used in expressions. Built-in substitution symbol functions are especially useful in conditional assembly expressions. Parameters of these functions are substitution symbols or character-string constants.
In the function definitions shown in Table 6-1, a and b are parameters that represent substitution symbols or character-string constants. The term string refers to the string value of the parameter. The symbol ch represents a character constant.
| Function | Return Value |
|---|---|
| $$symlen (a) | Length of string a |
| $$symcmp (a,b) | < 0 if a < b; 0 if a = b; > 0 if a > b |
| $$firstch (a,ch) | Index of the first occurrence of character constant ch in string a |
| $$lastch (a,ch) | Index of the last occurrence of character constant ch in string a |
| $$isdefed (a) | 1 if string a is defined in the symbol table |
| 0 if string a is not defined in the symbol table | |
| $$ismember (a,b) | Top member of list b is assigned to string a |
| 0 if b is a null string | |
| $$iscons (a) | 1 if string a is a binary constant |
| 2 if string a is an octal constant | |
| 3 if string a is a hexadecimal constant | |
| 4 if string a is a character constant | |
| 5 if string a is a decimal constant | |
| $$isname (a) | 1 if string a is a valid symbol name |
| 0 if string a is not a valid symbol name | |
| $$isreg (a)(1) | 1 if string a is a valid predefined register name |
| 0 if string a is not a valid predefined register name |
The following example shows built-in substitution symbol functions.
.asg label, ADDR ; ADDR = label
.if ($$symcmp(ADDR, "label") = 0) ; evaluates to true
LDR R4, ADDR
.endif
.asg "x,y,z" , list ; list = x,y,z
.if ($$ismember(ADDR,list)) ; ADDR = x, list = y,z
SUB R4, R4, #4 ; sub x
.endif