Hardware manual

Microcomputer Technical Q&A
13
Q&A No.: QAH8S-012
Category: Instruction
Subject: Support of DAA (DAS) Instruction Corresponding to INC (DEC)
Instruction
Questions
1. The DAA instruction is used for an add instruction (ADD instruction). What operation is
performed if a DAA instruction is executed after an INC instruction?
2. The DAS instruction is used for a subtract instruction (SUB instruction). What operation is
performed if a DAS instruction is executed after a DEC instruction?
Answers
1. Use of the DAA instruction after execution of an INC instruction is not supported. This is
because the operation result is indicated by the C and H flags after an INC instruction is
executed. To decrement decimal data, add –1 with an ADD instruction (ADD.B #–1, Rd), then
execute a DAA instruction.
2. Use of the DAS instruction after execution of a DEC instruction is not supported. This is
because the operation result is indicated by the C and H flags after a DEC instruction is
executed. To decrement decimal data, add 1 with an ADD instruction (ADD.B #1, Rd), then
invert the C and H flags (XORC #A0, CCR) and execute a DAS instruction.
Note: However, the actual operation is determined by the flag statuses.
Applicable Products
Applicability Series Applicability Series Applicability Series
Yes Entire H8S Series H8S/2655 H8S/2350
H8S/2355 H8S/2357 H8S/2345
H8S/2245 H8S/2148 H8S/2144
H8S/2138 H8S/2134 H8S/2128
H8S/2124