Write a program to count number of I’s in the contents of D register and store the count in the B register

No comments
Count’s number of one’s in a number

Statement : Write a program to count number of I’s in the contents of D register and store the count in the B register. 

Sample program:

(2200H)  =  04
(2201H)  =  34H
(2202H)  =  A9H
(2203H)  =  78H
(2204H)  =  56H
Result     =  (2202H)  =  A9H
MVI  B,  00H
MVI  C,  08H
MOV  A,  D
BACK     :  RAR
JNC  SKIP
INR  B
SKIP       :  DCR  C
JNZ  BACK
HLT        : “Terminate program execution”


No comments :

Post a Comment

Subscribe

Milan Panda
Admin
About Me | Contact
Copyright 2023-2024 © Programming1011 . 🎀 Developed and Design By- Milan Panda. Happy Holi All Of You 🎀