Decimal Mode Flag
The decimal mode flag (or for short decimal flag) is one of seven single-bit flags stored in the processor status register of the 6510 CPU. The decimal flag defines the operational mode how the basic arithmetic of the CPU work. This concerns only the instructions ADC and SBC. In decimal mode the outcome of other flags (zero flag, carry flag and negative flag) which are set accordingly in normal mode is not defined. This has not been fixed until the introduction of the CPU family's 16-bit branch WDC 65C802/816. Some CPU detection code is based on checking these flags to recognize a running 802/816 (e.g. on a SuperCPU or similar extension).
The decimal flag state is not defined after a hardware reset and should be set to defined state during the reset handling procedure.
Even on interruptions by an IRQ or NMI the state of the flag has to be considered to prevent a service routine from calculating in the wrong mode.
The following instructions affect the decimal flag.