Comment 10 for bug 584093

Revision history for this message
Debjit Biswas (debjitbis08) wrote :

Hi,

I have created a patch for the DAA instruction. I observed that there were 3 basic errors in the DAA code which are as follows:

1. The most significant 4 bits (which is stored in the "high" variable) was being updated before the operation on the lower bits. It should be updated after the operation.
2. The overflow condition was being checked by comparing whether the operation on the 4 bits is producing a value greater than 9. This should compared with 15 (2^4 = 16).
3. The manual states that the Carry flag will be set if there is a overflow after the operation on the higher 4 bits, but it should not be unchanged if there is no overflow. The older code was resetting the flag if there was no overflow.

I am attaching this patch. Can anyone please point to some sample code to test it with? I have tested a few examples I found in the manual, and the of course the code provided in the description of this bug :)

-- Debjit