Share via


ARM Directives for Conditional Assembly

9/7/2007

The ARM assembler supports conditional assemblies for sections of a source file; that is, it assembles the specified sections if certain conditions are true.

In addition, the assembler supports WHILE...WEND directives for conditional looping that are useful for generating repetitive tables.

Conditional looping produces an assembly-time loop, not a run-time loop. Because the test for the WHILE condition is made at the top of the loop, it is possible that no code is generated during assembly; lines are listed as for conditional assembly.

The following ARM assembler directives are required for conditional and repetitive assembly.

  • [ or IF
    Marks the start of the condition.
  • ] or ENDIF
    Marks the end of the condition.
  • | or ELSE
    Provides an else construct.
  • WHILE
    Marks the start of the repetitive condition.
  • WEND
    Marks the end of the repetitive condition.

Note that the characters [, |, and ] cannot be the first character in a line. These characters must be preceded by a space or a tab.

The following code shows the syntax for conditional assembly.

[ logical-expression
...code...
|
...code...
]

The following code shows the syntax for repetitive assembly.

WHILE logical-expression
...code...
WEND

See Also

Concepts

ARM Assembler Directives