Changes

Jump to: navigation, search

MOS 6502

61 bytes added, 13 March
/* Decimal Mode */
== Decimal Mode ==
Decimal Mode allows arithmetic operations to use Binary-Coded Decimal (BCD) , where each nibble (4 bits) represents a decimal digit (0-9), instead of binary. When this mode is enabled with the SED instruction, ADC and SBC instructions handle decimal digits (0-9) in each byteare automatically adjusted.
On NMOS, when Decimal Mode is on, the ADC and SBC instructions update NF, VF and ZF based on the binary result before the decimal correction is applied. Only CF is updated correctly. On CMOS, all the flags are updated correctly, at the cost of 1 additional cycle.
11,551
edits