;This program inputs a byte from location 300h
; and outputs the number of '1' bits in that byte into location 301h
;
;
        mov     ah,     byte ptr 300h   ;grab the input
        mov     bh,     0       ;count of the one bits
deloop: cmp     ah,     0
        je      fini
        add     ah,     ah      ;double the number (mult by 10, base 2)
;                               this shifts the number one position to left
;                               leaving the leftmost bit in the carry flag
        jnc     deloop
        add     bh, 1           ;count the '1' bit
        jmp     deloop
fini:   mov     byte ptr 301h, bh       ;move out the count of '1' bits
        hlt
        end