dseg segment
varw dw 0110110110110011B
dseg ends
cseg segment
assume cs:cseg, ds:dseg
start: mov ax, dseg
mov ds, ax
mov ax, [varw]
mov cx, 10h
xor dl, dl ;结果存入dl中
next: mov bx, ax
push cx
dec cx
shr bx, cl
pop cx
and bx, 1h
jz skip
inc dl
skip: loop next
mov ah, 4ch
int 21h
cseg ends
end start