SED

From NES Hacker Wiki
Revision as of 14:25, 11 April 2014 by TheAlmightyGuru (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Set Decimal Flag
Opcode: SED
Operation: 1 → D
Status Register: Status-List.png
Status-Ignore.pngStatus-Space.pngStatus-Ignore.pngStatus-Space.pngStatus-Ignore.pngStatus-Space.pngStatus-Ignore.pngStatus-Space.pngStatus-Set.pngStatus-Space.pngStatus-Ignore.png

SED (Set Decimal Flag) set the Decimal Flag in the Processor Status Register by setting the 3rd bit 1. To clear the decimal flag, use CLD. 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 SED opcode functions when it is executed.

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

Addressing Modes

Addressing Mode Assembly Language Form Opcode # Bytes # Cycles
Implied SED F8 1 2

Examples