(急需!)200分!求汇编语言,从屏幕上输入2进制数字,转换成10进制以后从屏幕上输出

来源:百度知道 编辑:UC知道 时间:2024/07/07 17:16:08
在今天一点半之前贴上来吧,我真的是急需!过了时间就没用了,先在此感谢了哈!
最好附上注释,要不然我看不懂……

;求汇编语言,从屏幕上输入2进制数字,转换成10进制以后从屏幕上输出
;运行正确
code segment
assume cs:code
start:
push cs
pop ds
lea dx,str;提示
mov ah,9
int 21h
xor bp,bp
mov cx,8
Q0:mov ah,0
int 16h
cmp al,0dh;回车结束输入
jz exit
cmp al,'0';
jb Q0
cmp al,'1'
ja Q0
Q2:mov ah,0eh
int 10h
sub al,30h
cbw
shl bp,1
add bp,ax
loop Q0
mov al,'='
mov ah,0eh
int 10h
mov ax,bp
mov cx,3
lea di,mes
R1:xor dx,dx
div word ptr [di]
add ax,0e30h
int 10h
add di,2
mov ax,dx
loop R1
mov ax,0e0dh
int 10h
mov al,0ah
int 10h
Q4:jmp Q0
exit:
mov ah,4ch
int 21h
str db 'Input a Bin...',0dh,0ah,'$'
mes dw 100,10,1
code ends
end start