Conditions (IF_x)

Every Propeller Assembly instruction has an optional "condition" field that is used to dynamically determine whether or not it executes when it is reached at run time. The basic syntax for Propeller Assembly instructions is:

< Label > < Condition > Instruction Operands < Effects >

The optional Condition field can contain one of 32 conditions (see IF_x (Conditions)) and defaults to IF_ALWAYS when no condition is specified. During compilation, the 4-bit Value representing the condition is used in place of the –CON– field's default bits in the instruction's opcode.

This feature, along with proper use of instructions' optional Effects field, makes Propeller Assembly very powerful. For example, the C and Z flags can be affected at will and later instructions can be conditionally executed based on those results.

When an instruction's condition evaluates to FALSE, the instruction dynamically becomes a NOP, elapsing 4 clock cycles but affecting no flags or registers. This makes the timing of multi-decision code very ;;deterministic since the same path of execution (same execution time) can be used and yet can achieve one of many possible outcomes.

See IF_x (Conditions) for more information.

Unless otherwise noted, content on this site is licensed under the
Creative Commons Attribution-ShareAlike 4.0 International License.