Talk:DEX
From C64-Wiki
Jump to navigationJump to searchOld content before this article was updated[edit source]
DEX (short for "DEcrease X") is the mnemonic for a machine language instruction which decrements the numerical value of X index register, by one, and "wraps over" if the value goes below the numerical limits of a byte.
- If the X index register is taken as an unsigned integer, DEX "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 X index register is taken as a signed integer, DEX will "count down" from +127 thru −128, or +$7F thru −$80. If the register is already holding the value −128/−$80 when it is decremented, it "wraps over" to the value +127/$7F.
Addressing mode[edit source]
Opcode | Addressing mode |
Assembler format |
Length in bytes |
Number of cycles | |
Dec | Hex | ||||
202 | CA | Implied | DEX | 1 | 2 |
DEX only supports the Implied addressing mode, as shown in the table at right.
CPU flags[edit source]
DEX 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.
Which sentences are important to paste into the new updated article? --Jodigi 01:39, 18 January 2011 (CET)