6431+3101的汇编程序

来源:百度知道 编辑:UC知道 时间:2024/05/18 04:01:53

code segment
assume cs:code
main proc far
push ds
xor ax,ax
push ax

mov ax,6431
mov bx,3101
add bx,ax
call btob
call crlf
ret
main endp

btob proc near
mov cx,10000
call ddiv
mov cx,1000
call ddiv
mov cx,100
call ddiv
mov cx,10
call ddiv
mov cx,1
call ddiv
ret
btob endp

ddiv proc near
mov ax,bx
mov dx,0
div cx
mov bx,dx
mov dl,al
add dl,30h
mov ah,2
int 21h
ret
ddiv endp

crlf proc near
mov dl,0ah
mov ah,2
int 21h
mov dl,0dh
mov ah,2
int 21h
ret
crlf endp
code ends
end main