.FOR and .ENDF

Begin for loop.

.FORop1 = op2 { TO | DOWNTO} op3 [ BYop4] [ DO]

stmtlist

.ENDF

Remarks

Initialize op1 to op2 and perform stmtlist until op1 is greater ( TO) or less than ( DOWNTO) op3. Makes use of a user-defined operand, op1, to serve as a loop counter. The .FOR- TO loop allows counting upward, while .FOR- DOWNTO allows counting downward. The programmer may specify an increment/decrement step size in op4, or elect the default step size of #1 by omitting the BY clause. A .FOR- TO loop is not executed if op2 is greater than op3 upon entry to the loop. Similarly, a .FOR- DOWNTO loop is not executed if op2 is less than op3.

The op1 must be a writable register or memory location. It is initialized at the beginning of the loop and updated with each pass through the loop. Any immediate operands must be preceded by a pound sign ( #). Memory references must be preceded by a memory space qualifier (X: or P:).

The logic generated by the .FOR directive makes use of several DSP data registers. In fact, two data registers are used to hold the step and target values, respectively, throughout the loop; they are never reloaded by the generated code. It is recommended that these registers not be used within the body of the loop, or that they be saved and restored prior to loop evaluation.

The DO keyword is optional.