SED
From C64-Wiki
Jump to navigationJump to searchSED (short for "SEt Decimal flag") is the mnemonic for a machine language instruction which sets the decimal flag. It complements the CLD (clear decimal flag) instruction.
Addressing mode[edit | edit source]
Opcode | Addressing mode |
Assembler format |
Length in bytes |
Number of cycles | |
Dec | Hex | ||||
248 | F8 | Implied | SED | 1 | 2 |
SED only supports the Implied addressing mode, as shown in the table at right.
CPU flags[edit | edit source]
SED affects no processor status flags other than the decimal flag, which is always unconditionally set.
Examples[edit | edit source]
Convert a hex digit to PETSCII
Convert a hex digit in the accumulator ($00 to $0F) to PETSCII symbol "0" to "9" ($30 to $39) or "A" to "F" ($41 to $46)
SED CMP #$0A ; sets carry if accumulator is $0A to $0F ADC #$30 ; decimal mode add 30+carry = 30 or 31 CLD