145C:0010 31 39 37 35 20 10 00 00-00 20 03 00 20 05 00 20 1975 .... .. ..
145C:0020 31 39 37 36 20 20 00 00-00 20 07 00 20 04 00 20 1976 ... .. ..
145C:0030 31 39 37 37 20 7E 01 00-00 20 09 00 20 2A 00 20 1977 ~... .. *.
145C:0040 31 39 37 38 20 4C 05 00-00 20 0D 00 20 68 00 20 1978 L... .. h.
145C:0050 31 39 37 39 20 56 09 00-00 20 1C 00 20 55 00 20 1979 V... .. U.
145C:0060 31 39 38 30 20 40 1F 00-00 20 26 00 20 D2 00 20 1980 @... &. ..
145C:0070 31 39 38 31 20 80 3E 00-00 20 82 00 20 7B 00 20 1981 .>.. .. {.
145C:0080 31 39 38 32 20 A6 5F 00-00 20 DC 00 20 6F 00 20 1982 ._.. .. o.
145C:0090 31 39 38 33 20 91 C3 00-00 20 DC 01 20 69 00 20 1983 .... .. i.
145C:00A0 31 39 38 34 20 C7 7C 01-00 20 0A 03 20 7D 00 20 1984 .|.. .. }.
145C:00B0 31 39 38 35 20 81 24 02-00 20 E9 03 20 8C 00 20 1985 .$.. .. ..
145C:00C0 31 39 38 36 20 8A 03 03-00 20 A2 05 20 88 00 20 1986 .... .. ..
145C:00D0 31 39 38 37 20 7C 47 05-00 20 D2 08 20 99 00 20 1987 |G.. .. ..
145C:00E0 31 39 38 38 20 EB 03 09-00 20 E9 0A 20 D3 00 20 1988 .... .. ..
145C:00F0 31 39 38 39 20 CA 42 0C-00 20 C5 0F 20 C7 00 20 1989 .B.. .. ..
145C:0100 31 39 39 30 20 18 0D 12-00 20 03 16 20 D1 00 20 1990 .... .. ..
145C:0110 31 39 39 31 20 38 1F 1C-00 20 22 20 20 E0 00 20 1991 8... " ..
145C:0120 31 39 39 32 20 58 19 2A-00 20 16 2D 20 EF 00 20 1992 X.*. .- ..
145C:0130 31 39 39 33 20 28 44 39-00 20 5E 38 20 04 01 20 1993 (D9. ^8 ..
145C:0140 31 39 39 34 20 28 F0 46-00 20 99 3B 20 30 01 20 1994 (.F. .; 0.
145C:0150 31 39 39 35 20 68 97 5A-00 20 88 45 20 4D 01 20 1995 h.Z. .E M.
以上是实验之后的数据,下面是实验代码。
;*********************
; Data Process
;*********************
assume cs:code,ss:stack,es:table
stack segment
db 0,0,0,0,0,0,0
stack ends
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,32,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,11542
dw 14430,15257,17800
data ends
table segment
db 21 dup ('year summ ne ?? ')
table ends
code segment
start:mov ax,data
mov ds,ax
mov dx,table
mov es,dx
mov bx,stack
mov ss,bx
mov sp,10h
mov cx,21
mov bx,0 ;初始化各个寄存器
y_:push cx
mov cx,2
mov si,0
y:push ds:[bx+si]
pop es:[si]
add si,2
loop y
mov ax,es
inc ax
mov es,ax
add bx,4
pop cx
loop y_ ;移动年份到table
mov ax,table
mov es,ax
mov cx,21
mov si,0
mov bx,0
zc:mov bp,cx
mov cx,2
mov si,0
z:push ds:[bx+si+84]
pop es:[si+5]
add si,2
loop z
add bx,4
mov ax,es
inc ax
mov es,ax
mov cx,bp
loop zc ;转移资产到指定区域
mov ax,table
mov es,ax
mov bx,0
mov si,0
mov bp,data
mov ds,bp
mov bp,0
mov cx,21
ry:
mov ax,ds:[bx+168]
mov es:[10],ax
add bx,2
mov ax,es
inc ax
mov es,ax
loop ry ;将雇佣人员数量转移到指定区域
mov ax,table
mov ds,ax
mov bx,0
mov dx,0
mov cx,21
cfloop:
mov ax,ds:[5]
mov dx,ds:[7]
div word ptr ds:[10]
mov ds:[13],ax
mov bx,ds
inc bx
mov ds,bx
loop cfloop
mov ax,4c00h
int 21h
code ends
end start
至于题目,还是说一下吧。《汇编语言》第二版,也就是王爽汇编第二版,的实验7.
有如下数据
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,32,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,11542
dw 14430,15257,17800
data ends
table segment
db 21 dup ('year summ ne ?? ')
table ends
要将他们排列成
如上图所示的样子,然后算出每个人的平均所得。