INC Variable

Function
Increment value of Variable by one.

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

flags           VAR     Byte(2)
result          VAR     Word

Main:
  flags(0) = 0
  INC flags(0)                                  ' flags(0) = flags(0) + 1

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

Related Instruction: DEC