SLAU131V October 2004 – February 2020
The --asm_define option equates a constant value or a string with a symbol. The symbol can then be used in place of a value in assembly source. The format of the --asm_define option is as follows:
cl430 --asm_define=name[=value] |
The name is the name of the symbol you want to define. The value is the constant or string value you want to assign to the symbol. If the value is omitted, the symbol is set to 1. If you want to define a quoted string and keep the quotation marks, do one of the following:
Once you have defined the name with the --asm_define option, the symbol can be used with assembly directives and instructions as if it had been defined with the .set directive. For example, on the command line you enter:
cl430 --asm_define=SYM1=1 --asm_define=SYM2=2 --asm_define=SYM3=3 --asm_define=SYM4=4 value.asm
Since you have assigned values to SYM1, SYM2, SYM3, and SYM4, you can use them in source code. Example 2 shows how the value.asm file uses these symbols without defining them explicitly.
In assembler source, you can test the symbol defined with the --asm_define option with these directives:
Type of Test | Directive Usage |
---|---|
Existence | .if $isdefed("name") |
Nonexistence | .if $isdefed("name") = 0 |
Equal to value | .ifname=value |
Not equal to value | .if name!=value |
The argument to the $isdefed built-in function must be enclosed in quotes. The quotes cause the argument to be interpreted literally rather than as a substitution symbol.