# 帮小弟我分析一下这个代码

www.MyException.Cn  网友分享于：2013-02-13  浏览：12次

Assembly code
```assume cs:codesg
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,2248,2793,4037,5635,8226
dw 11542,14430,15257,17800
;这是人数
data ends

table segment
db 21 dup('year summ ne ?? ')
table ends

codesg segment
start:
mov ax,data
mov ds,ax
mov ax,table
mov es,ax
mov bx,0
mov bp,0
mov si,0
mov di,0

mov cx,21
s:
mov al,[bx+si]
mov es:[bp],al
mov al,[bx+si+1]
mov es:[bp+1],al
mov al,[bx+si+2]
mov es:[bp+2],al
mov al,[bx+si+3]
mov es:[bp+3],al
;以上移入年份

mov dx,[bx+si]
mov es:[bp+5],dx
mov dx,[bx+si+2]
mov es:[bp+7],dx

mov si,0
loop s

mov bp,0
mov bx,0
mov si,0
mov cx,21
s2:
mov ax,[bx+0a8h]        ;放入人数
mov es:[bp+0ah],ax
loop s2

mov bp,0
mov cx,21
s3:
mov ax,[bx+si]
mov dx,[bx+si+2]
mov si,0a8h
div [bx+si]        ;除以人数
mov [bp+0dh],ax
mov si,0
loop s3

mov ax,4c00h
int 21h

codesg ends
end start

```

Assembling: F:\masm5\proj\8.asm
F:\masm5\proj\8.asm(71) : error A2023: instruction operand must have size
F:\masm5\proj\8.asm(21) : error A2004: symbol type conflict
F:\masm5\proj\8.asm(23) : error A2004: symbol type conflict
F:\masm5\proj\8.asm(84) : warning A4023: with /coff switch, leading underscore required for start address : start

------解决方案--------------------

------解决方案--------------------

------解决方案--------------------

71行的问题是不能直接div [内存]，应该拿寄存器中转一下。
21行，23行错误相同