← Back to team overview

gnusim8085-devel team mailing list archive

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

 

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.

-- 
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: Triaged

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