assume cs:code
data segment
db '1975','1976','1977','1978','1979','1980','1981','1982','1983'
db '1984','1985','1986','1987','1988','1989','1990','1991','1992'
db '1993','1994','1995'
dd 16,22,382,1356,2390,8000,16000,24486,50065,97479,140417,197514
dd 345980,590827,803530,1183000,1843000,2759000,3753000,4649000,5937000
dw 3,7,9,13,28,38,130,220,476,778,1001,1442,2258,2793,4037,5635,8226
dw 11542,14430,15257,17800
data ends
temp segment
db 10 dup(0)
temp ends
stack segment
db 64 dup(0)
stack ends
code segment
start:
mov ax,stack
mov ss,ax
mov sp,64
mov ax,data
mov es,ax
mov ax,temp
mov ds,ax
mov si,0
mov bp,0
mov bx,0
mov di,0
mov cx,21
s: push cx
mov ax,es:[bx]
mov ds:[si],ax
mov ax,es:[bx+2]
mov ds:[si+2],ax
mov byte ptr ds:[si+4],0
mov dh,24
sub dh,cl
mov dl,3
mov cl,2
call show_str
push dx
mov ax,es:[84+bp]
mov dx,es:[84+bp+2]
call dtoc
pop dx
add dl,10
call show_str
push dx
mov ax,es:[168+di]
mov dx,0
call dtoc
pop dx
add dl,10
call show_str
push dx
push cx
mov ax,es:[84+bp]
mov dx,es:[84+bp+2]
mov cx,es:[168+di]
call divdw
call dtoc
pop cx
pop dx
add dl,10
call show_str
add bx,4
add bp,4
add di,2
pop cx
loop s
mov ax,4c00h
int 21h
show_str:
push ax
push bx
push cx
push si
push di
push es
mov bl,cl
mov bh,0
mov ax,0b800h
mov es,ax
mov al,0a0h
mov ah,0
mul dh
mov di,ax
mov al,2h
mov ah,0
mul dl
add di,ax
write_str:
mov ch,0
mov cl,[si]
jcxz ok
mov es:[di],cl
mov es:[di+1],bl
inc si
add di,2
jmp short write_str
ok:
pop es
pop di
pop si
pop cx
pop bx
pop ax
ret
divdw:
push bx
push ax
mov ax,dx
mov dx,0
div cx
mov bx,ax
pop ax
div cx
mov cx,dx
mov dx,bx
pop bx
ret
dtoc:
push bx
push cx
push si
mov cx,0
push cx
mov bx,1
div_continue:
mov cx,10
call divdw
add cx,30H
push cx
inc bx
mov cx,dx
jcxz hzero
jmp short div_continue
hzero:
mov cx,ax
jcxz lzero
jmp short div_continue
lzero:
mov cx,bx
s_move:
pop bx
mov ds:[si],bx
inc si
loop s_move
pop si
pop cx
pop bx
ret
code ends
end start
下面是运行结果: