Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Count bits

Hi there,

I am trying write a program which count number of 1 in the 8-bit. I am storing input number in decimal and trying to find out how many 1 is there in binary 1. But not getting how to do. Please find my code as follow:

[code]
data segment
n db 7 ;Define input number data ends



code segment
assume cs:code, ds:data, ss:stack1

start:

mov ax, data
mov ds, ax
mov al, 0
mov bl, n
;and bl, 00000001b

inc al

mov ah, 4ch
int 21h
code ends

end start
[/code]

Is any one can help me?

Thanking You,

Comments

Sign In or Register to comment.