This the multi-page printable view of this section.Click here to print.

Return to the regular view of this page.

Increment

Increment by one a register or a memory location

Table of Contents

The increment instructions add one to either a register or a memory location.

Unlike adding 1 with ADC, these instructions does not use the Carry flag in any way. You can test for wraparound only by testing after every increment to see if the result is zero or positive.

The d flag does not affect these instructions. The increment is always in binary mode.

For all processors, the increment is an 8-bit operation unless m=0 on the 65816 in which case the increment is 16-bit.

INC - Increment

Increment by 1 the contents of the memory location or accumulator.

INX - Increment Index Register X

Increment by 1 the X index register.

INY - Increment Index Register Y

Increment by 1 the Y index register.

Flags Affected
Flags
n-----z-
nSet if most significant bit of the result is set
zSet if result is zero
Instructions
SyntaxOpcode Available on: # of # of Addressing Mode
(hex) 6502 65C02 65816 bytes cycles
INC A1A x x 1 2 Accumulator
INC addrEE x x x 3 61 Absolute
INC dpE6 x x x 2 51, 2 Direct Page
INC addr,XFE x x x 3 71, 3 Absolute Indexed X
INC dp,XF6 x x x 2 61, 2 Direct Page Indexed X
INX E8 x x x 1 2 Implied
INY C8 x x x 1 2 Implied

Notes:

  1. 65816: Add 2 cycles if m=0 (16-bit memory/accumulator)
  2. 65816: Add 1 cycle if low byte of Direct Page register is not 0
  3. 65C02: Subtract 1 cycle if no page boundary is crossed