DEY
From C64-Wiki
Jump to navigationJump to searchDEY (short for "DEcrease Y") is the mnemonic for a machine language instruction which decrements the numerical value of Y index register, by one, and "wraps over" if the value goes below the numerical limits of a byte.
- If the Y index register is taken as an unsigned integer, DEY "counts down" from 255 thru 0/$FF thru $0. If the index register already contains the minimum value of 0/$0 as it is decremented, it "wraps over" to the value 255/$FF.
- If the Y index register is taken as a signed integer, DEY will "count down" from +127 thru −128, or +$7F thru −$80. If the register already contains the value −128/−$80 when it is decremented, it "wraps over" to the value +127/$7F.
Addressing mode[edit | edit source]
Opcode | Addressing mode |
Assembler format |
Length in bytes |
Number of cycles | |
Dec | Hex | ||||
136 | 88 | Implied | DEY | 1 | 2 |
DEY only supports the Implied addressing mode, as shown in the table at right.
CPU flags[edit | edit source]
DEY 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.