INX

From C64-Wiki
Jump to navigationJump to search

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

  • If the X index register is taken as an unsigned integer, INX "counts" from 0 thru 255/$0 thru $FF. If the register already holds value 255/$FF as it is incremented using INX, it "wraps over" to the value 0.
  • If the X index register is taken as a signed integer, INX 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
232 E8 Implied INX 1 2

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

CPU flags[edit | edit source]

INX 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.