汇编作业

来源:百度知道 编辑:UC知道 时间:2024/05/25 15:03:56
从键盘输入2个不大于1000的十进制数,完成相除操作,并显示结果(结果保留一位小数),完成后提示继续和退出

data segment
x dw ?
y dw ?
msg db'continue?Yes or No?$'
msg1 db'Input first number:$'
msg2 db'Input second number:$'
msg3 db'Shang is:$'
data ends
decihex segment
assume cs:decihex,ds:data
main proc far

mov ax,data
mov ds,ax
repeat:
lea si,x
lea dx,msg1
mov ah,9
int 21h
call decibin
call crlf
lea si,y
lea dx,msg2
mov ah,9
int 21h
call decibin
call crlf
mov ax,x
cwd
div word ptr [x+2]
push dx
mov bx,ax
lea dx,msg3
mov ah,9
int 21h
call binidec
mov dl,'.'
mov ah,2
int 21h
pop ax
mov cx,10
mul cx
div word ptr [x+2]
mov bx,ax
mov cx,1
call dec_div
cal