8085 microprocessor program

Solution
(Do not double-post)
This is obviously home-work (these processors were modern more than 30 years ago). Show us what you have done up to now.
Hint: Rotate the register eight times, and count how many times the LSB was set.

prachi55

Estimable
May 8, 2015
5
0
4,510


 

prachi55

Estimable
May 8, 2015
5
0
4,510
assume data in B register.B is 8 bit register.store number of 1's in H and 0's in L



MVI C,08H
MVI H,00H
MOVA,B
RAL
JNC NEXT
INR H
DCR C
JNZ UP
MVI A,0H
SUB H
MOV L,A
HLT
 
The last time I wrote 8080/8085/z80 code was somewhere in 80's, but here are my 2 cents:
- the label "UP" is not defined (it should be before "RAL" instruction
- the label "NEXT" is not defined, it should be before "DCR C" instruction
- "MVI A, 0H" should be "MVI A, 8H" where you calculate number of zeroes
 

prachi55

Estimable
May 8, 2015
5
0
4,510