王爽汇编实验7

王爽汇编实验7

assume cs:codesg,ds:datasg,ss:stacksg,es:table

datasg 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'
	;以上是21年的 21个字符串, (字节)
	
	dd 16,22,382,1356,2390,8000,16000,24486,50065,97479,140417,197514
	dd 345982,590827,803530,1183000,184300,27759000,3753000,4649000,5937000
	;以上是21年的公司总收入的21个word型数据(双字)
	
	dw 3,7,9,13,28,38,130,220,476,778,1001,1442,2258,2793,4037,5635,8226
	dw 11542,14430,15257,17800
	;以上是21年公司雇员人数 单位()
datasg ends

stacksg segment
	;栈区代码存放位置
	dw 0,0,0,0
stacksg ends

table segment
	;附加段代码存放位置
	db 21 dup ('year!summ!ne!???')
table ends 

codesg segment
	;代码段
	start:	mov ax,datasg
			mov ds,ax
			mov di,0
			
			mov ax,table
			mov es,ax
			mov si,0
			
			mov bx,0
			mov cx,15H
			
		s:	push cx
		;insert years into es
			mov ax,ds:[si]
			mov es:[di],ax
			mov ax,ds:[si+2]
			mov es:[di+2],ax
		;insert income (earning) into es
			mov byte ptr es:[di+4],20H
			mov ax,ds:[si+54H]
			mov es:[di+5],ax
			mov ax,ds:[si+56h]
			mov es:[di+7],ax
			mov byte ptr es:[di+9],20H
		;insert employee into es
			mov ax,ds:[bx+0A8H]
			mov word ptr es:[di+10],ax
			mov byte ptr es:[di+12],20H
		;insert average	into es
			mov ax,ds:[si+54H]
			mov dx,ds:[si+56h]
			mov cx,es:[di+0AH]
			div cx
			mov word ptr es:[di+0DH],ax
			mov byte ptr es:[di+0FH],20H
			
			pop cx
			add di,10H
			add si,4
			add bx,2
			loop s
			
			
			mov ax,4c00h
			int 21h

codesg ends

end start
©️2020 CSDN 皮肤主题: 深蓝海洋 设计师:CSDN官方博客 返回首页