INC (INCrement)

[operand] = [operand] + 1

INC (INCrement) is an instruction that adds one to the specified operand, which can be either a memory location or the accumulator register (A). The result is stored back into the operand, and the Zero and Negative flags are set based on the result.

Note: If you increment a value beyond its maximum range, it will wrap around to the minimum value. For example, incrementing 0xFF will result in 0x00.

Addressing Modes

Mode

Syntax

Bytes

Cycles

ZeroPage

INC zp

E6 nn

5

ZeroPage+X

INC zp,x

F6 nn

6

Absolute

INC addr

EE ll hh

6

Absolute+X

INC addr,x

FE ll hh

7

Flags Affected

  • N (Negative) – Set if the result has the most significant bit set (i.e., is negative); otherwise, it is cleared.

  • Z (Zero) – Set if the result is zero; otherwise, it is cleared.

Examples

Increment a Memory Location

    LDA #0     ; load A with 0
    STA $10    ; store 0 at memory location $10
    INC $10    ; increment memory location $10 to 1

See Also

  • DEC (DECrement)

Comments