English

Write procedure of DAA instruction to convert hexadecimal number in to Binary Coded Decimal (BCD) number with suitable example. - Computer Science 2

Advertisements
Advertisements

Question

Write procedure of DAA instruction to convert hexadecimal number in to Binary Coded Decimal (BCD) number with suitable example. 

Very Long Answer
Advertisements

Solution

The DAA (Decimal Adjust Accumulator) instruction is used to convert the hexadecimal result of the addition of two BCD numbers into a valid packed BCD number. It is used only after the ADD/ADC/ADI instruction.

Procedure

  1. Perform addition: Add two BCD numbers using ADD/ADC/ADI. The result (in hexadecimal form) is stored in Accumulator (A).

  2. Check lower nibble (units digit): If lower nibble > 9 OR Auxiliary Carry (AC) = 1 → Add 06H to accumulator.

  3. Check upper nibble (tens digit): After step 2, if upper nibble > 9

    OR Carry flag (CY) = 1 → Add 60H to the accumulator.

  4. Final result: The accumulator now contains a valid packed BCD number. If CY = 1, it indicates an extra digit (hundreds).

Add 68 and 85 (BCD numbers)

Perform addition → 68H + 85H = EDH

Lower nibble check → EDH + 06H = F3H

Upper nibble check → F3H + 60H = 153H

Final result 

A = 53H

CY = 1

shaalaa.com
  Is there an error in this question or solution?
2025-2026 (March) Official Board Paper
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×