王爽 实验7 答案
可算是写出来了,
assume cs:code,ds:data
data segment
db '1975','1976','1977','1978','1979'
db '1980','1981','1982','1983','1984'
db '1985','1986','1987','1988','1989'
db '1990','1991','1992','1993','1994'
db '1995'
dd 16,22,382,1356,2390,8000,16000,24486
dd 50065,97479,140417,197514,345980,590837
dd 803530,1183000,1843000,2759000,3753000
dd 4649000,5937000
dw 3,7,9,13,28,38,130,220,476,778,1001,1442
dw 2258,2793,4037,5635,8226,11542,14430
dw 15257,17800
data ends
table segment
db 21 dup ('year summ ne ?? ')
table ends
code segment
start: mov ax,data
mov ds,ax
mov bx,0 ;data address to ds
mov si,0 ;and bx si for year and sum
mov ax,table ;table set addr to ss
mov ss,ax ;and bp
mov bp,0
mov cx,21 ;21 times loop for table
s: mov ax,[bx+si] ;move first 2bytes of year to table
mov [bp],ax
mov ax,[bx+si+2] ;move second 2bytes to table
mov [bp+2],ax
mov byte ptr [bp+4],' ' ;insert a blank space
mov ax,[bx+0a8h] ;move number of people
mov [bp+10],ax ;
mov byte ptr [bp+12],' ' ;insert a blank
mov ax,[bx+si+54h] ;income for remove 把收入放在人数后面执行是因为
mov [bp+5],ax ;meantime, put the dividend ax,dx 的数据正好用来做除法
mov dx,[bx+si+54h+2] ;into ax,dx 省了mov来,mov去的了,少几条指令
mov [bp+7],dx ;
mov byte ptr [bp+9],' ' ;insert a blank
div word ptr [bp+10] ;calculate average income
mov [bp+13],ax
mov byte ptr [bp+15],' '
add bx,2 ;next loop
add si,2
add bp,10h
loop s
mov ax,4c00h
int 21h
code ends
end start