Changes

MOS 6502

202 bytes added, 13 March
/* Decimal Mode */
== Decimal Mode ==
 
Decimal Mode allows arithmetic operations to use Binary-Coded Decimal (BCD) instead of binary. When enabled with the SED instruction, ADC and SBC instructions handle decimal digits (0-9) in each byte.
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,368
edits