;本程序经masm5.0调试通过....
dseg segment ;数据段
buf dw 0101101010101011B
dseg ends
sseg segment stack
db 80h dup(0)
sseg ends
cseg segment
assume cs:cseg,ds:dseg,ss:sseg
start:mov ax,dseg
mov ds,ax
mov si,offset buf;偏移地址送给si
mov cx,16
xor bx,bx
mov ax,[si]
next:ror ax,1;每次循环右移1次
jnc Jump
inc bl
Jump:
loop next
mov ax,bx
mov bx,0ah
call Deci_Output
mov ah,4ch
int 21h
;---------------------------出口参数输出字符
;---------------------------功能:十六进制转为十进制输出
Deci_Output proc near;入口参数ax,bx=0ah
push dx
xor dx,dx
or ax,ax
jz a001
div bx
call Deci_Output
add dl,'0'
push ax
mov ah,02h
int 21h
pop ax
a001:pop dx
ret
Deci_Output endp
cseg ends
end start