CLD

From NES Hacker Wiki
Jump to: navigation, search
Clear Decimal Flag
Opcode: CLD
Operation: 0 → D
Status Register: Status-List.png
Status-Ignore.pngStatus-Space.pngStatus-Ignore.pngStatus-Space.pngStatus-Ignore.pngStatus-Space.pngStatus-Ignore.pngStatus-Space.pngStatus-Clear.pngStatus-Space.pngStatus-Ignore.png

CLD (Clear Decimal Flag) clears the Decimal Flag in the Processor Status Register by setting the 3rd bit 0. To set the decimal flag, use SED. Even though the NES doesn't use decimal mode, the opcodes to clear and set the flag do work, so if you need to store a bit, this acts as a free space.

Operation

This pseudo C code shows how the CLD opcode functions when it is executed.

SET_DECIMAL((0));             // Set the 3rd bit of the processor status to 0.

Addressing Modes

Addressing Mode Assembly Language Form Opcode # Bytes # Cycles
Implied CLD D8 1 2

Examples