assume cs:codesg,ds:datasg,es:table
datasg segment
db '1975','1976','1977','1978','1979','1980','1981','1982','1983','1984'
db '1985','1986','1987','1988','1989','1990','1991','1992','1993'
db '1994','1995'
dd 16,22,382,1356,2390,8000,16000,24486,50065,97479,140417,197514,345980
dd 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
dw 11542,14430,15257,17800
dw 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
datasg ends
table segment
db 21 dup('fcuk dup command')
table ends
codesg segment
start: mov ax,datasg
mov ds,ax ;定义数据段
mov bx,0000H ;段起始地址
mov ax,table
mov es,ax ;定义table段
mov bp,0000H ;行起始地址
mov di,0000H ;行内年份字段起始地址
mov cx,21
year: mov dx,cx
mov cx,4
year0: mov al,[bx]
mov es:[bp+di],al
inc bx
inc di
loop year0
mov es:[bp+di],20H ;空格
add bp,0010H ;定位talbe段中下一条记录
mov di,0000H ;定位talbe段中下一条记录的年份初始地址
mov cx,dx
loop year
mov bp,0000H ;行起始地址
mov di,0005H ;行内年收入字段起始地址
mov cx,21
sum: mov dx,cx
mov cx,4
sum0: mov al,[bx]
mov es:[bp+di],al
inc bx
inc di
loop sum0
mov es:[bp+di],20H ;空格
add bp,0010H ;定位talbe段中下一条记录
mov di,0005H ;定位talbe段中下一条记录的年收入初始地址
mov cx,dx
loop sum
mov bp,0000H ;行起始地址
mov di,000aH ;行内雇员数字段起始地址
mov cx,21
emp: mov dx,cx
mov cx,2
emp0: mov al,[bx]
mov es:[bp+di],al
inc bx
inc di
loop emp0
mov es:[bp+di],20H ;空格
add bp,0010H ;定位talbe段中下一条记录
mov di,000aH ;定位talbe段中下一条记录的雇员数初始地址
mov cx,dx
loop emp
mov bp,0000H ;行起始地址
mov di,000dH ;行内人均收入字段的起始地址
mov cx,21
per: mov dx,cx
mov cx,2
per0: mov al,[bx]
mov es:[bp+di],al
inc bx
inc di
loop per0
mov es:[bp+di],20H ;空格
add bp,0010H ;定位talbe段中下一条记录
mov di,000dH ;定位talbe段中下一条记录的人均收入初始地址
mov cx,dx
loop per
mov bp,0000H ;行起始地址
mov cx,21
count:
mov di,0005H ;行内年收入字段起始地址
mov ax,es:[bp+di] ;被除数低八位放入ax寄存器
add di,0002H
mov dx,es:[bp+di] ;被除数高八位放入dx寄存器
add di,0003H ;di指向除数
div word ptr es:[bp+di] ;计算人均收入值
mov di,000dH ;di指向商数存放地址
mov es:[bp+di],ax ;商数存入人均收入字段
add bp,0010H ;定位talbe段中下一条记录
loop count
mov ax,4c00H
int 21H
codesg ends
end start
end
前面提得年份问题已经解决,现在的问题是,求商数不对,大家帮忙看看,最后那段代码,count循环那段,错哪里啦?