|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
assume cs:codesg,ds:datasg,es:tablesg
datasg segment
;ds:[bp] bp=0 add bp,4
db '1975','1976','1977','1978','1979','1980','1981','1982','1983'
db '1984','1985','1986','1987','1988','1989','1990','1991','1992'
db '1993','1994','1995';0-53H
;ds:[54h+bp] ax= ds:[84H+bp+0] dx= ds:[84h+bp+2] add bp,4
dd 16,22,382,1356,2390,8000,16000,24486,50065,97479,140417,197514
dd 345980,590827,803530,1183000,1843000,2759000,3753000,4649000,5937000
;54H-A7H
;ds:[di+a8h] add di,2
dw 3,7,9,13,28,38,130,220,476,778,1001,1442,2258,2793,4037,5635,8226
dw 11542,14430,15257,17800
;A8H-D1H
datasg ends
tablesg segment
db 21 dup ('year s n a ',0);
;0123456789abcdef012345789abcde
tablesg ends
; es:[bx] bx=0 add bx,20h bx+8 bx+12h bx+1bh
codesg segment
start:
mov ax,datasg
mov ds,ax
mov ax,tablesg
mov es,ax
mov bx,0;写入行数据
mov bp,0;收入
mov di,168;雇员
mov si,0
mov cx,21
s:
mov ax,ds:[bp]
mov es:[bx],ax
mov ax,ds:[bp+2]
mov es:[bx+2],ax;复制年份
mov ax,ds:[54h+bp] ;复制公司总收入
mov dx,ds:[54h+bp+2]
push di
mov di,8
call dddtoc
pop di
mov ax,ds:[di];复制公司雇员
mov dx,0
push di
mov di,18
call dddtoc
pop di
push cx
mov ax,ds:[54h+bp] ; 平均收入
mov dx,ds:[54h+bp+2]
mov cx,ds:[di]
call ddiv
pop cx
push di
mov di,27
call dddtoc
pop di
add bp,4
add di,2
add bx,32
loop s
mov ax,tablesg
mov ds,ax
mov si,0
mov cx,21
mov dh,4
show_cs:
push cx
mov dl,8
mov cl,2
call show_str
inc dh
add si,32
pop cx
loop show_cs
mov ax,4c00h
int 21h
ddtoc:
push dx
push bx
push ax
push cx
push di
push si
mov di,0
ddtoc_begin:
mov cx,10
call ddiv
add cx,30h
push cx
inc di
mov cx,ax
jcxz ddtoc_next
jmp short ddtoc_begin
ddtoc_next:
mov cx,dx
jcxz ddtoc_ok
jmp short ddtoc_begin
ddtoc_ok:
mov cx,di
ddtoc_s:
pop ax
mov ds:[si],al
inc si
loop ddtoc_s
pop si
pop di
pop cx
pop ax
pop bx
pop dx
ret
ddiv:
push bx
push ax
mov ax,dx
mov dx,0
div cx
mov bx,ax
pop ax
div cx
mov cx,dx
mov dx,bx
pop bx
ret
show_str:
push ax
push es
push bx
push cx
push si
mov ax,0b800h
mov es,ax
mov al,160
mul dh
mov bx,ax
mov al,2
mul dl
add bx,ax
mov al,cl
mov ch,0
show_str_copy:
mov cl,[si]
jcxz show_str_copy_over
inc si
mov es:[bx],cl
mov es:[bx+1],al
add bx,2
jmp short show_str_copy
show_str_copy_over:
pop si
pop cx
pop bx
pop es
pop ax
ret
dddtoc:
push bx
push ds
push si
mov si,bx
add si,di
mov bx,tablesg
mov ds,bx
call ddtoc
pop si
pop ds
pop bx
ret
codesg ends
end start |
|