← Back to team overview

gnusim8085-devel team mailing list archive

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

 

2010-09-24  Aanjhan Ranganathan  <aanjhan@xxxxxxxxxxxxx>

	* src/8085-instructions.c: Fixed the long standing DAA
	bug. Followed http://www.ray.masmcode.com/BCDdaa.html plus had to
	ensure the addition operation on the accumulator must be done
	using the _eef_inst_func_add_i function so as to ensure setting of
	the carry and other flags. Fixes bug LP: #584093.

Test cases tested: Courtesy: http://www.ray.masmcode.com/BCDdaa.html

Example 1:
   mov   al,38h        ;packed decimal "38"
   add   al,45h        ;add packed decimal "45"
   daa                 ;AL = 7Dh -> 83h  (with CF clear = 83 packed decimal)

Example 2:
   mov   al,88h        ;packed decimal "88"
   add   al,74h        ;add packed decimal "74"
   daa                 ;AL = 0FCh -> 62h  (with CF set = 162 packed decimal)

Example 3:
   mov   al,47h        ;packed decimal "47"
   add   al,69h        ;add packed decimal "69"
   daa                 ;AL = 0B0h -> 16h  (with CF set = 116 packed decimal)

** Changed in: gnusim8085
       Status: Confirmed => Fix Committed

** Changed in: gnusim8085
     Assignee: Aanjhan Ranganathan (aanjhan) => Onkar Shinde (onkarshinde)

-- 
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: Fix Committed

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

mvi a,078h
adi 088h
daa
hlt

please check

regards, Felix Fung





References