|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
断断续续用了一周的时间,期间有好几次思路错了,走了一些弯路。刚刚写完,后续还可以简化合并,然后再换一种思路重新写一下。
- assume cs:codesg,ds:data
- 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,5659000,5937000
- dw 3,7,9,13,28,38,130,220,476,778,1001,1442,2258,2793,4037,5635
- dw 8226,11542,14430,15257,17800
- data ends
- codesg segment
- start:
- mov ax,data
- mov ds,ax
- mov ax,0b828h ;从第四行开始显示
- mov es,ax
- mov dh,0 ;行号
- mov dl,0 ;列号
- mov si,0
- mov cx,21 ;大循环次数
-
-
- call input_show
-
- mov ax,4c00h
- int 21h
-
- input_show:
- push si
- push dx
- push ax
- push bx
- push cx
- push di
- push bp
-
- input_show_s0:
- push cx
- mov bp,0 ;在数据段中的位置
- mov si,0
- mov al,160
- mul dh ;行号*160
- mov bx,ax ;在显存中的行位置
- call show_year ;显示年份
- call show_emplyer ;显示人员
- call show_income ;显示收入
- call show_wage ;显示工资
- inc dh
- pop cx
- loop input_show_s0
- pop bp
- pop di
- pop cx
- pop bx
- pop ax
- pop dx
- pop si
- ret
- ;----------------------------显示年代-------------------------------------
- show_year:
- push si
- push dx
- push ax
- push bx ;不能动
- push cx
- push di
- push bp
- mov al,4
- mul dh ;确定显存位置已经结束,dx可用了
- mov bp,ax ;在数据段中进行移动
- mov cx,4 ;年代循环次数
- input_show_s1:
- mov ax,[bp]
- mov es:[bx+si],ax
- mov ax,07h
- mov es:[bx+si+1],ax
-
- inc bp
- add si,2
- loop input_show_s1
-
- pop bp
- pop di
- pop cx
- pop bx
- pop ax
- pop dx
- pop si
- ret
- ;-------------------------人员--------------------------------
-
-
- show_emplyer:
- push si
- push dx
- push ax
- push bx ;不能动
- push cx
- push di
- push bp
-
- mov al,2
- mul dh ;确定显存位置已经结束,dx可用了
- mov bp,ax
- mov ax,[bp+168]
- ; mov ax,3
- mov si,0
-
- show_employer_s0:
- mov cx,ax
- jcxz show_employer_input
- mov dx,0
- mov bp,10
- div bp
- mov bp,ax
- add dx,30h
- mov ax,dx
- push ax
- mov ax,bp
- inc si
- jmp show_employer_s0
-
- show_employer_input:
- mov cx,si
- mov si,0
- show_employer_s1:
- pop ax
- mov es:[bx+40+si],al
- mov al,07h
- mov es:[bx+41+si],al
-
- add si,2
- loop show_employer_s1
-
- pop bp
- pop di
- pop cx
- pop bx
- pop ax
- pop dx
- pop si
- ret
-
-
-
- ;------------------ 收入--------------
- show_income:
- push si
- push dx
- push ax
- push bx
- push cx
- push di
- push bp
-
- mov al,4
- mul dh
- mov bp,ax
- mov ax,[bp+84]
- mov dx,[bp+86]
- mov si,0
-
- show_income_s0:
- mov cx,ax
- jcxz show_income_input
- push ax
- mov ax,dx
- mov dx,0
- mov bp,10
- div bp
- mov di,ax
- pop ax
- div bp
- mov bp,ax
- add dx,30h
- mov ax,dx
- push ax
- mov dx,di
- mov ax,bp
- inc si
- jmp show_income_s0
-
- show_income_input:
- mov cx,si
- mov si,0
- show_income_input_s1:
- pop ax
- mov es:[bx+si+20],al
- mov al,07h
- mov es:[bx+si+21],al
- add si,2
- loop show_income_input_s1
-
- pop bp
- pop di
- pop cx
- pop bx
- pop ax
- pop dx
- pop si
- ret
- ;-------------------------人均收入---------------------------------------
- show_wage:
- push si
- push dx
- push ax
- push bx
- push cx
- push di
- push bp
-
- mov ax,4
- mul dh
- mov bp,ax ;确定公司总收入的位置
-
- mov ax,2
- mul dh ;确定显存位置已经结束,dx可用了
- mov di,ax ;确定公司人员的位置
-
- mov ax,[bp+84]
- mov dx,[bp+86]
- div word ptr [di+168]
-
- mov si,0
-
- show_wage_s0:
- mov cx,ax
- jcxz show_wage_input
- mov dx,0
- mov bp,10
- div bp
- mov bp,ax
- add dx,30h
- mov ax,dx
- push ax
- mov ax,bp
- inc si
- jmp show_wage_s0
-
- show_wage_input:
- mov cx,si
- mov si,0
- show_wage_s1:
- pop ax
- mov es:[bx+si+60],al
- mov al,07h
- mov es:[bx+si+61],al
-
- add si,2
- loop show_wage_s1
-
- pop bp
- pop di
- pop cx
- pop bx
- pop ax
- pop dx
- pop si
- ret
-
- ;------------------------------------------
-
-
- codesg ends
- end start
复制代码 |
|