← Back to team overview

gnusim8085-devel team mailing list archive

[Bug 584093] Re: 78+88 in BCD addition missed carry

 

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

** Patch added: "daa.patch"
   http://launchpadlibrarian.net/49670414/daa.patch

-- 
78+88 in BCD addition missed carry
https://bugs.launchpad.net/bugs/584093
You received this bug notification because you are a member of
GNUSim8085 developers, which is subscribed to gnusim8085.

Status in gnusim8085: Confirmed

Bug description:
With the following program, the carry flag is missed:

mvi a,078h
adi 088h
daa
hlt

please check

regards, Felix Fung





Follow ups

References