4 notes on using the alu – NEC PD17062 User Manual
Page 53
53
µ
PD17062
7.4 NOTES ON USING THE ALU
7.4.1 Notes on Using the Program Status Word for Operations
After an arithmetic operation has been performed on the program status word, the operation result is held
in the program status word.
The CY and Z flags of the program status word are usually set or reset according to the result of the
arithmetic operation. If the arithmetic operation is performed on the program status word itself, the result
of the operation is stored and a carry, borrow, or zero cannot be discriminated.
If the CMP flag is set, the result of the arithmetic operation is not stored and the CY and Z flags are set or
reset as usual.
7.4.2 Notes on Performing Decimal Operations
A decimal operation can be carried out only when the operation result is within the following ranges:
(1) The result of addition is between 0 and 19 in decimal.
(2) The result of subtraction is between 0 and 9 or –10 and –1 in decimal.
If a decimal operation exceeding the above ranges is performed, the CY flag is set, resulting in a value
greater than or equal to 1010B (0AH).