ASSUME CS:CODE,DS:DATA,ES:TABLE,SS:STACK
DATA SEGMENT PARA PUBLIC 'DATA'
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,184300,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
TABLE SEGMENT PARA PUBLIC 'TABLE'
DB 21 DUP ('year summ ne ?? ')
TABLE ENDS
STACK SEGMENT STACK
DW 0800H DUP(00)
STACK ENDS
CODE SEGMENT
MAIN PROC FAR
MOV AX,DATA
MOV DS,AX
MOV AX,TABLE
MOV ES,AX
CLD
XOR SI,SI
XOR BX,BX ; 传递年份
MOV CX,21
M1: XOR DI,DI
ADD DI,BX
MOVSW
MOVSW
ADD BX,16
LOOP M1
XOR BX,BX ; 传递雇员数
MOV CX,21
M2: MOV DI,5
ADD DI,BX
MOVSW
MOVSW
ADD BX,16
LOOP M2
XOR BX,BX ; 传递收入
MOV CX,21
M3: MOV DI,10
ADD DI,BX
MOVSW
ADD BX,16
LOOP M3
XOR BX,BX ; 计算人均收入
MOV CX,21
M4: MOV SI,5
ADD SI,BX
MOV AX,ES:[SI]
MOV DX,ES:[SI + 2]
DIV WORD PTR ES:[SI + 5]
MOV WORD PTR ES:[SI + 8],AX
ADD BX,16
LOOP M4
MOV AX,04C00H
INT 021H
MAIN ENDP
CODE ENDS
END MAIN