求汇编语言 10到2 10到十六的转换代码

来源:百度知道 编辑:UC知道 时间:2024/09/24 19:13:21
要求从键盘输入一个10进制数,能从屏幕上显示出转换后的2进制
十到16进制也是一样的。 最好是调试无错的代码啊

(1).10-2
输入要求:
首先输入位数
其次输入指定位数的十进制
data segment
input1 db 'please input the numbers of the decimal(1-5):$'
input2 db 'input the decimal number:$'
input3 db 'the binary number is:$'
data ends

code segment
assume cs:code,ds:data
main proc far
start:
mov ax,data
mov ds,ax
mov dx,offset input1
mov ah,09h
int 21h
call crlf

mov ah,01h
int 21h
sub al,30h
mov bl,al
cbw
call crlf
mov cx,bx
mov bx,0

mov dx,offset input2
mov ah,09h
int 21h
call crlf

m1: mov ah,01h