汇编程序35:实验10 编写子程序(二)
1 assume cs:code,ds:data,ss:stack 2 3 data segment 4 dw 123,12666,1,8,3,38 5 data ends 6 7 stack segment 8 dw 8 dup(0) 9 stack ends 10 11 code segment 12 start: 13 mov ax,data 14 mov ds,ax 15 mov si,0 16 mov di,0 17 mov cx,6 18 s0: 19 mov ax,ds:[si] 20 mov dx,0 21 call dtoc 22 add si,2 23 loop s0 24 mov ax,4c00h 25 int 21h 26 dtoc: 27 push cx 28 mov bx,0ah 29 mov cx,3E8h 30 change: 31 push dx 32 push ax 33 div cx 34 push cx 35 mov cx,ax 36 call show_t 37 s: 38 pop cx 39 mov ax,cx 40 div bl 41 inc al 42 mov cl,al 43 mov ch,0 44 pop ax 45 mov ax,dx 46 pop dx 47 loop change 48 ok: 49 pop cx 50 ret 51 show_t: 52 push ax 53 push bx 54 mov ax,cx 55 jcxz op 56 mov bx,0ah 57 div bl 58 add ah,30h 59 mov byte ptr ds:[10h+di],ah 60 inc di 61 mov cl,al 62 jcxz op 63 mov byte ptr ds:[10h+di],ah 64 dec di 65 add al,30h 66 mov byte ptr ds:[10h+di],al 67 add di,2 68 op: 69 pop bx 70 pop ax 71 ret 72 code ends 73 74 end start