DECF

Decrement f

Decrement register ‘f’. If ‘d’ is ‘0’, the result is stored in the W register. If ‘d’ is ‘1’, the result is stored back in register ‘f’.

[the_ad id="3059"]

Syntax:

[ label ] DECF f,d

Operation:

(f) - 1 → (destination)

Operands:

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

Status Affected: Z

Example:

DECF REG,0

Before instruction:

REG = 0x0A
W = 0x01

After instruction:

REG = 0x0A
W = 0x09

[the_ad id="3059"]

Example:

COMF REG,1

Before instruction:

REG = 0x0A
W = 0x01

After instruction:

REG = 0x09
W = 0x01