SourcePoint Intel Help

Table of Contents

for

Group and execute commands in a loop.

Syntax

for(command1; bool-cond; command2) {commands}

Where:

command1

is usually an assignment statement or a function call, but can be any valid emulator command. If you omit the command1 option, the semicolon (;) must remain as a place holder.

bool-cond

specifies the test condition. The bool-cond option must evaluate to true (non-zero) or false (zero). If you omit the bool-cond option, the test condition defaults to true, and the semicolon (;) must remain as a placeholder.

command2

is usually a re-assignment, an increment, or a function call, but can be any emulator command. If you omit the command2 option, the semicolon (;) must remain as a placeholder.

commands

is one or more emulator commands that are executed when the test condition bool-cond is true. Braces ({ }) indicate the start and end of multiple commands controlled by the for construct. At least one command is required. However, you can enter an empty command, indicated by a semicolon (;).

Discussion

Use the for control construct to execute a block of commands one or more times. The iteration continues as long as bool-cond evaluates to non-zero (true) in the following order: command1 is executed once; then if bool-cond evaluates to true, {commands} is executed. After that, command2 is executed and bool-cond is evaluated. This process is repeated as long as bool-cond evaluates to true. ย To break out of a loop press ctrl+break.

Note: ย You cannot use the include command within a for control construct.

Example

Command input:

define int i
for (i = 0; i < 3; i = i + 1)
ย printf("%\n", i)

Result:

00000000H

00000001H

00000002H

Related Topics: