DEX is an opcode for the 6502 processor. It decreases the value in the X register by 1. If the register contains zero before this instruction is executed, its value will wrap around so that it contains 255 (equivalent to -1 in 8-bit 2's complement arithmetic).

The N and Z flags may be affected by this instruction's execution.

The machine code representation of this opcode is 0xCA.

Back to the 6502 opcodes metanode

1. Nickname (by shortening) for Dexter.

A 6502 instruction that subtracts 1 from register X, wrapping the value to 255 if it's already zero.

  • Function: X--
  • Updates flags: S . . . . . Z .
  • Opcode numbers:
    impl  $CA

Similar: DEC | DEY | INC | INX | INY
See also: 6502 instructions | 6502 addressing modes

Log in or register to write something here or to contact authors.