|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
- assume cs:code
- 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,2258,2793,4037,5635,8226
- dw 11542,14430,15257,17800
- data ends
- table segment
- db 21 dup ('year summ ne ?? ')
- table ends
- ;First we have to move the data from data segment to table just as the format below
- ;year(4byte)(20H)income(4byte)(20H)Number of employees(2byte)(20H)per capita income(2byte)(20H)
- ;Example
- ;1975 16 3 23
- code segment
- start:
- mov ax,data
- mov ds,ax ;Later we will move data from it
- mov ax,table
- mov es,ax ;Later we will move data into it
- xor si,si ;empty the register si
- xor bx,bx ;empty bx
- mov cx,21 ;the data is from 1975-1995 so we have to loop for 21 times
- s: ;the purpose of the loop is to move the data(year) from data segment into table segment
- mov ax,ds:[bx]
- mov es:[si],ax
- add bx,2
- mov ax,ds:[bx]
- mov es:[si+2],ax
- add bx,2
- add si,10H
- loop s
- mov cx,21
- xor si,si
- xor bp,bp
- mov bp,5
- s1: ;the purpose of the loop is to move the data(income) from data segment into table segment
- mov ax,ds:[bx]
- mov es:[si+bp],ax
- add bx,2
- mov ax,ds:[bx]
- mov es:[si+bp+2],ax
- add bx,2
- add si,10H
- loop s1
- xor si,si
- xor bp,bp
- mov bp,0AH
- mov cx,21
- s2: ;the purpose of the loop is to move the data(Number of employees) from data segment into table segment
- mov ax,ds:[bx]
- mov es:[si+bp],ax
- add bx,2
- add si,10H
- loop s2
- mov si,000EH
- mov bx,168
- xor di,di
- mov di,84
- mov cx,21
- s3: ;the purpose of the loop is to div the data(income/Number of employees) from data segment into table segment
- mov ax,ds:[di]
- add di,2
- mov dx,ds:[di]
- div word ptr ds:[bx]
- add bx,2
- mov es:[bp+13],ax
- loop s3
- mov ax,4C00H ;end the programme
- int 21H
- code ends
- end start
复制代码
代码运行时报错divide overflow |
|