programb16 - Microprocessors & Applications (UPTU)...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Appendix B ØØ Explanation : Consider that two words are available in registers AX and BX. We have to add these two words. Using add instruction, add the contents, of the lower two bits i.e. add AL and BL. The result of this addition is stored in the AL register. DAA instruction is then used to convert the result to valid BCD. Now, add the contents of MSB alongwith carry if generated in LSB addition. The result of MSB addition is stored in the AH register. Adjust this result to valid BCD number. The final result is available in the BX register. The DAA instruction operates only on the AL register and so here, we have to add LSB and MSB separately without using ADD AX, BX. eg. : AX = 3629 BCD BX = 4738 BCD Step I : 2 9 + 3 8 6 1 and auxiliary carry = 1 As AC = 1, add 6 to make result valid. 61 + 6 = 67 Step II : 36 + 47 + 0 (Carry of LSB) = 7 D. Lower nibble of addition is greater than 9, so add 6.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 3

programb16 - Microprocessors & Applications (UPTU)...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online