Keil Logo Arm Logo

A251 User's Guide

WHILE Function

The WHILE MPL function repeats a block until a specified condition is TRUE. The syntax for the WHILE function is:

%WHILE (expression) (balanced-text)

The WHILE function first evaluates the expression. If it is TRUE the balanced-text is expanded and the expression is reevaluated. If it is TRUE the balanced-text is expanded again and so on. This loop repeats until the expression is FALSE.

The balanced-text must modify the expression or the WHILE function never terminates. Additionally, the balanced-text may call the EXIT MPL function to terminate the WHILE function.

Source Text

%SET (count, 5)                %'initialize count to 5'
%WHILE (%count GT 0)
(
ADD   R5,R5
%SET (count, %count - 1)
)

Output Text

ADD   R5,R5
ADD   R5,R5
ADD   R5,R5
ADD   R5,R5
ADD   R5,R5

Keil logo

Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.