1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
| assume cs:code data segment db 10 dup(0) data ends code segment start: mov ax,12666 mov bx,data mov ds,bx mov si,0 call dtoc mov dh,8 mov dl,3 mov cl,2 call show_str mov ax,4c00h int 21h dtoc: push dx push cx push si mov cx,11 push cx mov cx,10 s: mov dx,0 div cx push dx cmp ax,0 jne s s1: pop ax add ax,30h mov ds:[si],ax inc si cmp ax,3Bh jne s1 sub si,1 mov ax,0 mov ds:[si],ax pop si pop cx pop dx ret
show_str: push ax push bx push cx push dx push si
mov ah,0 mov al,dh mov dh,0Ah mul dh add ax,0b800h mov es,ax mov al,dl mov dl,2 mul dl mov bx,ax s2: mov al,ds:[si] cmp al,0 je ok mov ah,cl mov es:[bx],ax inc si add bx,2 jmp s2 ok: pop si pop dx pop cx pop bx pop ax ret code ends end start
|