DEC (short for "DECrease") is the mnemonic for a machine language instruction which decrements the numerical value of the contents of the address specified, by one, and "wraps over" if the value goes below the numerical limits of a byte.
- If the byte in question is taken as an unsigned integer, DEC "counts down" from 255 thru 0/$FF thru $0. If a byte already containing the value 0/$0 is DECremented, it "wraps over" to the value 255/$FF.
- If the byte is taken as a signed integer, DEC will "count down" from +127 thru −128, or +$7F thru −$80. If a byte already holding the value −128/−$80 is DECremented, it "wraps over" to the value +127/$7F.
Addressing modes[edit | edit source]
DEC supports the four different addressing modes shown in the table at right. In the assembler formats listed, nn represents a single-byte (8-bit) figure, and nnnn is a two-byte (16-bit) address.
CPU flags[edit | edit source]
DEC affects 2 of the CPU's status flags: