I am trying to understand below snippet of assembly program from an x86 dump for addition program, where two numbers 6789 and 1234 is added, the problem is how this program deals with carries.
I know adding 6, when result is greater than 9, but this program has so many steps that make little sense to me.
and     ecx,0F0F0F0F           
              // masking zoned bits  -> 06 07 08 09
and     eax,0F0F0F0F              
            // masking zoned bits  -> 01 02 03 04
 add     ecx,eax         
            //  ecx value after addition 07 09 0B 0D (this is simple Binary add result,now need to convert it to BCD addition)
add     ecx,F6F6F6F6
            // after addition FE 00 02 03
mov     eax,ecx                  
             // eax = ecx = FE 00 02 03
and     eax,60606060
            // eax = 60 00 00 00
shr     eax,04 
            // eax = 06 00 00 00
and     ecx,0F0F0F0F
            // FE 00 02 03 & 0F 0F 0F 0F = 0E 00 02 03(ECX)
sub     ecx,eax 
            // 0E 00 02 03 - 06 00 00 00 = 08 00 02 03               // 8023 ans
 
     
    