三个模块都集合在一个文件里了,,
assume cs:code,ss:stack data segment db 10 dup (0) data ends stack segment db 16 dup (0) stack ends code segment start: mov ax,12666 mov bx,data mov ds,bx mov bx,stack mov ss,bx mov sp,16 mov si,0 call dtoc mov dh,8 mov dl,3 mov cl,2 call show_str mov ax,4c00h int 21h dtoc:mov dx,0 mov bp,sp mov cx,0 push cx s:mov cx,10 call divdw push cx mov cx,dx jcxz j1 jmp short s j1:mov cx,ax jcxz ok jmp short s ok: pop cx jcxz finish add cx,30h mov [si],cl inc si jmp short ok finish:mov si,0 ret show_str: push dx push cx push si mov ax,0b800h mov es,ax mov ax,0a0h mul dh mov bx,ax add dl,dl mov ax,0 mov al,dl add bx,ax mov di,0 ;输出位置 es:[bx+di] mov dl,cl mov cx,0 s1: mov ch,0 mov cl,[si] jcxz ok1 mov ax,[si] mov es:[bx+di],ax mov es:[bx+di+1],dl inc si add di,2 jmp short s1 ok1: pop si pop cx pop dx ret divdw:mov bx,ax mov ax,dx mov dx,0 div cx push ax mov ax,bx div cx mov cx,dx pop dx ret code ends end start