You copied the Doc URL to your clipboard.

Assemblytime 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 $ prefix in the places where the value is to be substituted for the variable. The dollar character instructs armasm to substitute the string into the source code line before checking the syntax of the line. armasm faults if the substituted line is larger than the source line limit.

Numeric and logical variables can also be substituted. Thecurrent value of the variable is converted to a hexadecimal string(or T or F for logical variables)before substitution.

Use a dot to mark the end of the variable name if the followingcharacter would be permissible in a symbol name. You must set thecontents of the variable before you can use it.

If you require a $ that you do not wantto be substituted, use $$. This is convertedto a single $.

You can include a variable with a $ prefixin a string. Substitution occurs in the same way as anywhere else.

Substitution does not occur within vertical bars, except thatvertical 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    14s1          SETS    "a$$b$count" ; s1 now has value a$b0000000Es2          SETS    "abc"fixup       SETS    "|xy$s2.z|"  ; fixup now has value |xyabcz||C$$code|   MOV     r4,#16       ; but the label here is C$$code
Was this page helpful? Yes No