跳至主要內容
Knowledgebase
Home
Renesas Electronics Taiwan - Knowledgebase

What happens if tally like 0Ah + 0Bh/AAh + BBh processed in decimal mode?

Latest Updated:03/01/2005

Question:

(CPU)  The following is stated in the D flag description:
"The D flag determines whether additions and subtractions are executed in binary or decimal. Binary arithmetic is executed when this flag is "0"; decimal arithmetic is executed when it is "1". Decimal correction is automatic in decimal mode. Only ADC and SBC instructions can be used for decimal arithmetic."
What happens when calculations such as "0Ah + 0Bh" or "AAh + BBh" are processed in decimal mode ? [2005/03/01]

Answer:

In decimal mode calculations, the operation circuit assumes that the value to be calculated is in BCD code. The BCD code value is calculated as a binary and the result is corrected into BCD code. During this correction, values other than BCD code cannot be processed properly, and therefore the result will be incorrect. (#104742)
Suitable Products
3803H
3803L
3823
3850A
3858
38D2
38D5
7544
7545
7546
7547
7548
7549