programb13 - Microprocessors Applications(UPTU Explanation...

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 a byte of data is present in the AL register and a second byte of data is present in the BL register. We have to add byte in AL with the byte in BL. Using add instruction, add the contents of 2 registers. Result will be stored in the AL register. Use DAA instruction that will check if BCD is valid, if it is not valid then 6 is added to give proper BCD result. Display the result. ØØ Algorithm : Step I : Initialize the data memory. Step II : Get the first BCD number in AL. Step III : Get the second BCD number in BL. Step IV : Add the two BCD numbers. Step V : Using DAA, adjust result to valid BCD number. Step VI : Display the result. Step VII : Stop. ØØ Flowchart : Refer flowchart 13. ØØ Program : .model small .data a db 09H Flowchart 13 b db 02H .code mov ax, @data ; Initialize data section mov ds, ax mov al, a ; Load number1 in al mov bl, b ; Load number2 in bl add al, bl ; add numbers and result in al daa ; adjust result to valid BCD number
Background image of page 1

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

View Full Document Right Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 2

programb13 - Microprocessors Applications(UPTU Explanation...

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