Effects (WC, WZ, WR, NR)

Every Propeller Assembly instruction has an optional "effects" field that causes it to modify a flag or register when it executes. The basic syntax for Propeller Assembly instructions is:

< Label > < Condition > Instruction Operands < Effects >

The optional Effects field can contain one or more of the four items shown below. For any effect not specified next to the instruction in code, the default behavior remains as indicated by the corresponding bit (Z, C, or R) in the ZCRI field of the instruction's opcode.

Effects

Effect

Description

WC

Updates C Flag. See WC.

WZ

Updates Z Flag. See WZ.

WR

Updates Destination Register. See WR.

NR

Preserves Destination Register. See NR.


Follow an instruction with one to three comma-delimited Effects to cause that instruction to affect the indicated item. For example:

              and     temp1, #$20    wc
              andn    temp2, #$38    wz, nr
if_c_and_z    jmp     #MoreCode 

The first instruction performs a bitwise AND of the value in the temp1 register with $20, stores the result in temp1 and modifies with C flag to indicate the parity of the result. The second instruction performs a bitwise AND NOT of the value in the temp2 register with $38, modifies the Z flag according to whether or not the result is zero, and does not write the result to temp2. During the execution of the first instruction, the Z flag is not altered. During the execution of the second instruction, the C flag is not altered. If these instructions did not include the WC and WZ effects, those flags would not be altered at all. The third instruction, which specifies a Condition, jumps to the MoreCode label (not shown) but only if both the C and Z flags are set; otherwise, the JMP instruction acts like a NOP instruction.

Using Effects on instructions, along with Conditions on later instructions, enables code to be much more powerful than what is possible with typical assembly languages. 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.