ASSUME CS:CODES,DS:DATA,es:table
DATA SEGMENT
db '1975','1976','1977','1978'
db '1979','1980','1981','1982'
db '1983','1984','1985','1986'
db '1987','1988','1989','1990'
db '1991','1992','1993','1994'
db '1995'
dd 16,22,382,1356
dd 2390,8000,16000,24486
dd 50065,97479,140417,197514
dd 345980,590827,803530,1183000
dd 1843000,2759000,3753000,4649000
dd 5937000
dw 3,7,9,13,28,38,130,220
dw 476,778,1001,1442,2258,2793,4037,5635
dw 8226,11542,14430,15275,17800
DATA ENDS
color segment
db 9,9,12,12,12,12,12,9,12,12,12,12,12,10,10,9,12,12,12,12,12,12,12,9,12,12,12,12,12,12,9,9
color ends
head segment
db "||YEAR |VALUEK$| STAFF |SALARY||"
head ends
line segment
db'|+-----+-------+-------+------+|'
line ends
table segment
db 21 dup ('year summ ne ?? ')
table ends
cache segment
db 10 dup (0)
cache ends
CODES SEGMENT
START:
MOV AX,DATA
MOV DS,AX
mov ax,table
mov es,ax
mov si,0
mov di,0
mov cx,15H
s:mov bx,0
mov ax,[bx+si]
mov dx,[bx+si+2]
mov es:[0],ax
mov es:[2],dx
mov bx,0a8H
mov ax,[bx+di]
mov es:[10],ax
mov bx,54H
mov ax,[bx+si]
mov dx,[bx+si+2]
mov es:[5],ax
mov es:[7],dx
div word ptr es:[10]
mov es:[13],ax
add di,2
add si,4
mov bx,es
inc bx
mov es,bx
loop s
mov ax,0b800h
mov es,ax
call title1
call frame
call main
MOV AH,4CH
INT 21H
title1:mov bx,color
mov ds,bx
mov ax,head
sub ax,bx
mov bx,10h
mul byte ptr bl
mov si,ax
mov bx,0
mov cx,32
mov di,bx
t1:mov ah,ds:[bx]
mov al,ds:[bx+si]
inc bx
mov es:[di],ax
add di,2
loop t1
ret
frame:mov ax,0b800h
mov es,ax
mov ax,0a0h
mov di,ax
call across
call vertical
call across
ret
across:mov ax,line
mov ds,ax
xor bx,bx
mov si,bx
mov ah,9
mov cx,32
l1:mov al,ds:[si]
mov es:[bx+di],ax
add bx,2
inc si
loop l1
ret
vertical:mov ax,097ch
mov dx,0
call v1
mov dx,2
call v1
mov dx,0eh
call v1
mov dx,1eh
call v1
mov dx,2eh
call v1
mov dx,3ch
call v1
mov dx,3eh
call v1
mov di,si
ret
v1:mov bx,140h
mov di,dx
mov cx,21
v2:mov es:[bx+di],ax
add bx,0a0h
loop v2
mov si,bx
ret
main:mov ax,table
mov ds,ax
call year
call value
call staff
call income
ret
year:mov cx,21
mov bx,140h
y1:push cx
mov cx,4
mov si,0
mov ax,4
mov di,ax
mov ah,7
y2:mov al,ds:[si]
mov es:[bx+di],ax
inc si
add di,2
loop y2
pop cx
mov ax,ds
inc ax
mov ds,ax
add bx,0a0h
loop y1
ret
value:mov ax,table
mov ds,ax
mov si,0
add si,5
mov cx,21
mov bx,10h
add bx,140h
v:push cx
push ds
push si
push bx
mov ax,ds:[si]
mov dx,ds:[si+2]
call divdw
mov ax,cache
mov ds,ax
mov ah,7
pop bx
push bx
mov cx,di
mov di,0
mov si,0
v4:mov al,ds:[si]
inc si
mov es:[bx+di],ax
add di,2
loop v4
pop bx
add bx,0a0h
pop si
add si,10h
pop ds
pop cx
loop v
ret
staff:mov ax,table
mov ds,ax
mov si,0
add si,10
mov cx,21
mov bx,22h
add bx,140h
s1:push cx
push ds
push si
push bx
mov ax,ds:[si]
mov dx,0
call divdw
mov ax,cache
mov ds,ax
mov ah,7
pop bx
push bx
mov cx,di
mov di,0
mov si,0
s2:mov al,ds:[si]
inc si
mov es:[bx+di],ax
add di,2
loop s2
pop bx
add bx,0a0h
pop si
add si,10h
pop ds
pop cx
loop s1
ret
income:mov ax,table
mov ds,ax
mov si,0
add si,0dh
mov cx,21
mov bx,32h
add bx,140h
i1:push cx
push ds
push si
push bx
mov ax,ds:[si]
mov dx,0
call divdw
mov ax,cache
mov ds,ax
mov ah,7
pop bx
push bx
mov cx,di
mov di,0
mov si,0
i2:mov al,ds:[si]
inc si
mov es:[bx+di],ax
add di,2
loop i2
pop bx
add bx,0a0h
pop si
add si,10h
pop ds
pop cx
loop i1
ret
divdw:
mov bx,10
mov di,bx
xor bx,bx
xor cx,cx
d:push ax
mov ax,dx
mov dx,0
div word ptr di
mov cx,ax
pop ax
div word ptr di
inc bx
add dx,30h
push dx
mov dx,cx
jcxz d1
jmp short d
d1:mov cx,ax
jcxz d2
jmp short d
d2:mov cx,bx
mov di,bx
mov bx,cache
mov ds,bx
xor bx,bx
d3:pop ax
mov ds:[bx],al
inc bx
loop d3
ret
CODES ENDS
END START