assume cs:codesg,ds:datasg,es:table,ss:stack
table segment
db '1975','1976','1977','1978','1979','1980','1981','1982','1983'
db '1984','1985','1986','1987','1988','1989','1990','1991','1991'
db '1993','1994','1995'
;以上是表示21年的21个字符串
dd 16,22,382,1356,2390,8000,16000,24486,50065,97479,140417,197514
dd 345980,590827,803530,1183000,1843000,2795000,3753000,4649000,5937000
;以上是表示21年公司总收入的21个dword型数据
dw 3,7,9,13,28,38,130,220,476,778,1001,1442,2258,2793,4037,5635,8226
dw 11542,14430,15257,17800
;以上是表示21年公司雇员人数的21个word型数据
dw 5,3,42,104,85,210,123,111,105,125,140,136,153,211,199,209,224,239
dw 260,304,333
;以上是表示21年公司人均收入
dd 10 dup (0)
table ends
datasg segment
db 1000 dup (0)
datasg ends
stack segment
db 100 dup (0)
stack ends
codesg segment
start:
mov ax,datasg
mov ds,ax
mov ax,table
mov es,ax
mov si,0
mov bp,0
mov ax,stack
mov ss,ax
mov sp,100
mov cx,21
s7: call dtoc
add bp,16 ;bp加16换行
add di,4 ;si+4
loop s7
mov ax,4c00h
int 21h
dtoc:
push cx
push di
push si
push bp
;cx、si入栈
s4:
mov ax,es:[di+54h]
mov dx,es:[di+56h]
mov bx,10
s1: mov bp,ax ;转移到L位
mov ax,dx ;dx值等于ax
xor dx,dx ;-----------H转AX D清零
div bx ;H除以bx
mov di,ax ;H结果=di
mov ax,bp ;ax植出栈,L重赋给ax
div bx ;-----------REG+L/10 DX=余娄 H结果=DI
;=========== L结果AX
mov cx,bp ;商为零cx
jcxz d_wk ;-----------余数为空jmp 到出栈
add dx,30h
push dx
inc si
xor dx,dx
;------------余数+30H=ASCII
mov dx,di
;------------H重赋给DX
jmp s1
;------------判断H为0,不为0循环
;============ 为0做L位除法
d_wk: mov cx,si
;------------设定循环数
;------------CX为0 jmpECS
jcxz s3 ;cx为零转移到s2
mov si,0
mov di,0 ;di等于0
s3: pop ax ;dx植出栈放入ax
mov es:[di+100h],al ;[bp+di+05h]=al
add di,1 ;di加1
loop s3 ;loop 循环
pop bp
mov cx,di
s2: mov al,es:[si+100h]
mov ds:[si+bp+05h],al
add si,1
loop s2
okay: pop si
pop di
pop cx
ret
codesg ends
end start