Skip to main content
Renesas Singapore - Knowledgebase

Can decimal adjustment not be performed in these products?

Latest Updated:01/01/2008


The 78K0R/Kx3 microcontroller does not have a decimal adjust instruction. Can decimal adjustment not be performed in these products?


Yes, it can perform decimal adjustment. The 78K0R/Kx3 microcontroller has a decimal correction circuit for this purpose.
As can be seen from the above operation example, decimal adjustment is done by adding or subtracting a adjustment value depending on the calculation result (carry or borrow at every four bits and value). In other words, the same result can be obtained by generating the adjustment value according to the calculation result and then adding or subtracting that adjustment value.
Thus, the same decimal adjustment result can be obtained without the decimal adjust instruction, and this is why the decimal adjust instruction has been deleted from the instruction set of the 78K0R.

Coffee Break
There are a number of decimal calculation methods. In terms of instructions, the use of decimal addition and decimal subtraction instructions is one approach, and the use of adjustment is another one. In the majority of cases, decimal adjustment is employed.
The 8080 family, the first generation of 8-bit microprocessors, used decimal adjust instructions for addition only, and performing subtractions in decimal required quite a lot of processing. Subsequent microprocessors that improved this point provided a flag indicating whether addition or subtraction was performed, enabling both addition and subtraction with one adjust instruction. This latter version was clearly easier to use, but since the former version was used in the market, the latter version gained little acceptance due to compatibility issues. Later, the Z80 was launched and the improved design featuring an additional flag became common. The method adding a flag was born from the need to be able to continue using existing software. Free from the constraint of existing software, the approach of the current 78K0 employing a adjust instruction for addition and a adjust instruction for subtraction allows a simpler configuration because it does not require the use of extra flags.
Suitable Products
RL78 Family