Assembler User GuidePreface Overview of the Assembler Overview of the ARM Architecture Structure of Assembly Language Modules Writing ARM Assembly Language Condition Codes Using the Assembler Symbols, Literals, Expressions, and Operators Symbol naming rules Variables Numeric constants Assembly time substitution of variables Register-relative and PC-relative expressions Labels Labels for PC-relative addresses Labels for register-relative addresses Labels for absolute addresses Numeric local labels Syntax of numeric local labels String expressions String literals Numeric expressions Syntax of numeric literals Syntax of floating-point literals Logical expressions Logical literals Unary operators Binary operators Multiplicative operators String manipulation operators Shift operators Addition, subtraction, and logical operators Relational operators Boolean operators Operator precedence Difference between operator precedence in assembly VFP Programming Assembler Command-line Options ARM and Thumb Instructions VFP Instructions Directives Reference Via File Syntax
Assembly time substitution of variables
7.4 Assembly time substitution of variables
You can assign a string variable to all or part of a line of assembly language code. A string variable can contain numeric and logical variables.
Use the variable with a
Numeric and logical variables can also be substituted. The current value of the variable is converted to a hexadecimal string (or
Use a dot to mark the end of the variable name if the following character would be permissible in a symbol name. You must set the contents of the variable before you can use it.
If you require a
You can include a variable with a
Substitution does not occur within vertical bars, except that vertical bars within double quotes do not affect substitution.
; straightforward substitution GBLS add4ff ; add4ff SETS "ADD r4,r4,#0xFF" ; set up add4ff $add4ff.00 ; invoke add4ff ; this produces ADD r4,r4,#0xFF00 ; elaborate substitution GBLS s1 GBLS s2 GBLS fixup GBLA count ; count SETA 14 s1 SETS "a$$b$count" ; s1 now has value a$b0000000E s2 SETS "abc" fixup SETS "|xy$s2.z|" ; fixup now has value |xyabcz| |C$$code| MOV r4,#16 ; but the label here is C$$code
of your data.