Comment 3 for bug 584093

Revision history for this message
Onkar Shinde (onkarshinde) wrote :

Here is the description of DAA instruction I found in - http://www.cs.otago.ac.nz/cosc243/lectures/is_detail.pdf
****************
The contents of the accumulator are changed from a binary value to two 4-bit binary coded decimal (BCD) digits. This is the only instruction that uses the auxiliary flag to perform the binary to BCD conversion, and the conversion procedure is described below. S, Z, AC, P, CY flags are altered to reflect the results of the operation.
If the value of the low-order 4-bits in the accumulator is greater than 9 or if AC flag is set, the instruction adds 6 to the low-order four bits.
If the value of the high-order 4-bits in the accumulator is greater than 9 or if the Carry flag is set, the instruction adds 6 to the high-order four bits.
****************

If you run the program in bug description in debug mode, you will find that instruction 'adi 088h' is setting both C and AC flags. Hence when DAA is executed 6 is added to both high-order and low-order bits and both flags are altered, making then 0.

So as per my understanding the behavior is correct here.