programb7 - Microprocessors Applications(UPTU Appendix B...

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

View Full Document Right Arrow Icon
Appendix B ØØ Explanation : We have a word that is stored in AX register. Initialize the counter 1 = 16. Initialize counter 2 = 0 to count the number of 1’s. We will rotate the number in AX alongwith carry by 1 bit to the right. If there is a carry we will increment counter 2. Decrement counter 1. This process with continue till all the bits are checked. The counter 2 will indicate the number of 1’s present in the word. The result of counter 2 is stored in BL. Display the result. eg. : AX = 5267 010 1 001 0 011 0 011 1 no of 1’s = 8 ØØ Algorithm : Step I : Initialize the data memory. Step II : Load the number in AX register. Step III : Initialize count in BL = 00 Initialize counter 1 = 16. Step IV : Rotate contents of register so that LSB will go in carry. Step V : Check if carry = 1. If not goto step VII. Step VI : Increment count in BL. Step VII
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.

This note was uploaded on 08/04/2011 for the course ECON 101 taught by Professor Lucky during the Spring '11 term at Silver Lake.

Page1 / 2

programb7 - Microprocessors Applications(UPTU Appendix B...

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