INCFSZ

Increment f, Skip if 0

The contents of register ‘f’ are incremented. If ‘d’ is ‘0’, the result is placed in the W register. If ‘d’ is ‘1’, the result is placed back in register ‘f’. If the result is ‘1’, the next instruction is executed. If the result is ‘0’, then a NOP is executed instead, making it a 2 TCY instruction.

Syntax:

[ label ] INCFSZ f,d

Operation:

(f) + 1 → (destination);
skip if result = 0

Operands:

  • f is from 0 to 127 (decimal)
  • d can be either 0 or 1

Status Affected: None

Example:

Before instruction:

After instruction:

The result is not zero, therefore, the line GOTO SUB1 is read.

Example:

Before instruction:

After instruction:

The result is zero, hence the line GOTO SUB1 is skipped and the program jumps to GOTO SUB2.