Keil Logo

Ax51 Introduction DA

Decimal adjust for addition

Description  

The DA instruction adjusts the 8-bit value in the accumulator to correspond to binary-coded decimal (BCD) format. This instruction begins by testing the low-order nibble of the accumulator. If the AC flag is set or if the low 4 bits of the accumulator exceed a value of 9, the accumulator is incremented by 6. The high-order nibble is then tested. If the carry flag is set or if the high 4 bits of the accumulator exceed a value of 9, the value 60h is added to the accumulator. This instruction performs a decimal conversion by adding 00h, 06h, or 66h to the accumulator depending on the initial contents of the PSW and accumulator.

DA A
C AC F0 RS1 RS0 OV P
Bytes   1
Cycles   1
Encoding   11010100
Operation  
DA

IF (A3-0 > 9) OR (AC = 1)
  A = A + 6

IF (A7-4 > 9) OR (C = 1)
  A = A + 60h
Example  
DA A
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.