← Back to team overview

gnusim8085-devel team mailing list archive

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

 

ps, you may refer to page 3-18 and 3-19 of the Intel 8080/8085 assembly
language
programming manual. If you donot have, I can send you a copy of it in pdf
format.

Regards, Felix

2010/5/28 Fung Felix <felixcpfung@xxxxxxxxx>

> Thank you for your explaination on the behavior of DAA. Please note that in
> BCD addition,
> 74 + 88 = 162. That means after addition and DAA, the accumulator should
> hold 62 and carry flag should be 1 and that is the correct behavior.
> Otherwise, 100 is missed and you can never make a correct multi-byte BCD
> Addition.
>
> Besides, as I reported seperately, 99+1 after DAA, the accumulator holds A0
> and carry flag
> is 0 which is also wrong.
>
> Based on the above observation, I believe that there must be a bug exist
> when doing DAA
> conversion.
>
> Perhaps you should run the hardware and also theck the CPU manual for the
> real behavior
> of the CPU
> Regards, Felix
>
>
>
> 2010/5/26 Onkar Shinde <onkarshinde@xxxxxxxxx>
>
> 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 direct subscriber
>> of the bug.
>>
>> 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
>>
>> To unsubscribe from this bug, go to:
>> https://bugs.launchpad.net/gnusim8085/+bug/584093/+subscribe
>>
>
>

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





References