288
Section 3: Assembler
TI
-
89 / TI
-
92 Plus Sierra C Assembler Reference Manual
Not for Distribution
Beta Version February 2, 2001
WHILE . . . ENDW
—
Loop While Condition True
Syntax
WHILE[.
size
]
expression
DO[.
extent
]
[
statement
]
.
.
.
ENDW
Description
size
Specifies the size qualifier for the structured control
expression
.
The legal values are shown below; if omitted, the size is
determined according to the rules discussed in section
3.4.2 Instruction Sizing
.
B
Byte Integer
W
Word Integer
L
Long-word Integer
expression
Specifies a structured control expression (see section
3.8.2.1 Structured Control Expressions
).
extent
Specifies the size of any forward branches that are generated to
span the loop body. The legal values are shown below; if omitted,
the size is determined by the current default forward branch size
(see
OPT BRB/BRS/BRW
directive).
B
8-bit forward branch
S
8-bit forward branch
W
16-bit forward branch
statement
Specifies an assembler statement.
The
WHILE . . . ENDW
macro is analogous to the
while
statement in C
—
i.e., it
generates a loop that executes while a specified condition is true. The
termination test is performed at the beginning of the loop; therefore, the loop is
not executed if the condition is false upon entry.
Code is generated to evaluate the structured control expression
expression
and
to perform the necessary flow of control. This will include either one or two
forward branches, depending on the expression’s complexity. An unconditional
backward branch is used to perform the next iteration of the loop. Upon normal
exit from the loop, the condition codes will reflect the final evaluation of
expression
.