INY

From C64-Wiki
Jump to navigationJump to search

INY (short for "INcrease Y") is the mnemonic for a machine language instruction which increases the numerical value held in the Y index register by one, and "wraps over" when the numerical limits of a byte are exceeded.

  • If the Y index register is taken as an unsigned integer, INY "counts" from 0 thru 255/$0 thru $FF. If the register already holds value 255/$FF as it is incremented, it "wraps over" to the value 0.
  • If the Y index register is taken as a signed integer, INY will "count" from −128 thru +127, or −$80 thru +$7F. If the register contains 127/$7F when incremented, it "wraps over" to the value −128/−$80.

Addressing mode[edit | edit source]

Opcode Addressing
mode
Assembler
format
Length
in bytes
Number of
cycles
Dec Hex
200 C8 Implied INY 1 2

INY only supports the Implied addressing mode, as shown in the table at right.

CPU flags[edit | edit source]

INY affects 2 of the CPU's status flags:

  • The negative status flag is set if the result is negative, i.e. has its most significant bit set.
  • The zero flag is set if the result is zero, or cleared if it is non-zero.