DAA (BCD addition) instruction. HC12/S12

Thread Starter

Jess_88

Joined Apr 29, 2011
174
Hey guys :)

I'm having a little trouble understanding what is going on with this instruction for the question.

Question
The HC12/S12 has a DAA instruction which takes the result of an addition operation and corrects the result to represent the result of a Binary Coded Decimal (BCD) addition. The instruction operations are as de- scribed in the table below.


The two numbers added together are $99 in the A register and $22 in the B register which actually represent 99 and 22 in BCD.

a)What is the result of executing an ABA instruction and the subsequent execution of a DAA instruction in- clude the effect on the carry (C) bit of the condition code register.

Solution
After execution of ABA Register A ___$BB___ Carry bit _______0_______
After execution of DAA Register A ___$21___ Carry bit _______1_______

I understand the addition of the to numbers in bcd (99 + 22 = BB), but what the heck is going on with DAA???:confused:

can anyone explain the steps taken? (showing what bits are contributing to the DCC instruction and how they change/why?)

thanks a bunch guys
 
Top