DEC Variable

Decrement value of Variable by one.

The DEC instruction subtracts one from the specified variable. If the variable holds zero it will roll over to its maximum value (255 for bytes, 65535 for words) after DEC.

flags           VAR     Byte(2)
result          VAR     Word

  flags(0) = 0
  DEC flags(0)                                  ' flags(0) = flags(0) - 1

  result = $0000
  DEC result                                    ' result is now $FFFF

Related Instruction: INC and DJNZ