标签:
assume cs:codesg data segment ;year db ‘1975‘,‘1976‘,‘1977‘,‘1978‘,‘1979‘,‘1980‘,‘1981‘,‘1982‘ db ‘1983‘,‘1984‘,‘1985‘,‘1986‘,‘1987‘,‘1988‘,‘1989‘,‘1990‘ db ‘1991‘,‘1992‘,‘1993‘,‘1994‘,‘1995‘ ;income dd 16,22,382,1356,2390,8000,16000,24486 dd 50065,97479,140417,197514,345980,590827,803530,1183000 dd 1843000,2759000,3753000,4649000,5937000 ;people number dw 3,7,9,13,28,38,130,220 dw 476,778,1001,1442,2258,2793,4037,5635 dw 8226,11542,14430,15257,17800 ;average dw 21 dup (0) ;first number is divider,second number is dividend low-order ;third number is dividend high-order,final number is remainder dw 0ah dw 3 dup (0) data ends stack segment dw 16 dup (0) stack ends codesg segment start: mov ax,stack mov ss,ax mov sp,20h mov ax,data mov ds,ax mov ax,0b800h mov es,ax call compute_averg call clear_scr call show_year call show_income call show_Pnumber call show_averg mov ax,4c00h int 21h show_year: push di push bx mov di,150h mov bx,0 mov ah,2 mov cx,15h year: push cx mov cx,4 push di sh_ys: mov al,ds:[bx] mov es:[di],ax inc bx add di,2 loop sh_ys pop di add di,0a0h pop cx loop year pop bx pop di ret show_income: push bp push di push si mov bp,84 mov di,160h mov cx,15h get_Incnum: push cx push di mov ax,ds:[bp] mov ds:[254],ax mov ax,ds:[bp+2] mov ds:[256],ax mov si,0 ILround: mov dx,0 call divdw add dx,30h push dx mov cx,ax inc si jcxz Iok jmp ILround Iok: mov cx,si Incnum: pop ax mov ah,2 mov es:[di],ax add di,2 loop Incnum add bp ,4 pop di add di,0a0h pop cx loop get_Incnum pop si pop di pop bp ret show_Pnumber: push si push bp push di mov bp,168 mov di,176h mov cx,15h get_Pnumber: push cx push di mov ax,ds:[bp] mov si,0 PSround: mov dx,0 div word ptr ds:[252] add dx,30h push dx mov cx,ax inc si jcxz Sok jmp PSround Sok: mov cx,si Pnumber: pop ax mov ah,2 mov es:[di],ax add di,2 loop Pnumber add bp,2 pop di add di,0a0h pop cx loop get_Pnumber pop di pop bp pop si ret show_averg: push bp push di mov bp,210 mov di,188h mov cx,15h get_Avergnum: push cx push di mov ax,ds:[bp] mov bx,0 ASround: mov dx,0 div word ptr ds:[252] add dx,30h push dx mov cx,ax inc bx jcxz Aok jmp ASround Aok: mov cx,bx Avergnum: pop ax mov ah,2 mov es:[di],ax add di,2 loop Avergnum add bp,2 pop di add di,0a0h pop cx loop get_Avergnum pop di pop bp ret compute_averg: push bx push bp push si mov bx,210 mov bp,84 mov si,168 mov cx,15h count: mov ax,ds:[bp] mov dx,ds:[bp+2] div word ptr ds:[si] mov ds:[bx],ax add bp,4 add si,2 add bx,2 loop count pop si pop bp pop bx ret divdw: mov ax,ds:[256] div word ptr ds:[252] mov ds:[256],ax mov ax,ds:[254] div word ptr ds:[252] mov ds:[254],ax mov ds:[258],dx or ax,ds:[256] ret clear_scr: push bp push di mov bp,0 mov cx,16h cs1: mov di,0 push cx mov cx,50h cs2: mov byte ptr es:[di+bp],0 mov byte ptr es:[di+bp+1],0 add di,2 loop cs2 add bp,0a0h pop cx loop cs1 pop di pop bp ret codesg ends end start
标签:
原文地址:http://www.cnblogs.com/regconfi/p/4187558.html