鱼C论坛

 找回密码
 立即注册
查看: 2375|回复: 0

[汇编作业] 课程设计1

[复制链接]
发表于 2017-5-10 16:23:01 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
断断续续用了一周的时间,期间有好几次思路错了,走了一些弯路。刚刚写完,后续还可以简化合并,然后再换一种思路重新写一下。
  1. assume cs:codesg,ds:data
  2. data segment
  3. db '1975','1976','1977','1978','1979','1980','1981','1982','1983'
  4. db '1984','1985','1986','1987','1988','1989','1990','1991','1992'
  5. db '1993','1994','1995'

  6. dd 16,22,382,1356,2390,8000,16000,24486,50065,97479,140417,197514
  7. dd 345980,590827,803530,1183000,1843000,2759000,3753000,5659000,5937000

  8. dw 3,7,9,13,28,38,130,220,476,778,1001,1442,2258,2793,4037,5635
  9. dw 8226,11542,14430,15257,17800

  10. data ends



  11. codesg segment

  12.         start:   
  13.                         mov ax,data
  14.                         mov ds,ax
  15.             mov ax,0b828h        ;从第四行开始显示
  16.                         mov es,ax
  17.                         mov dh,0    ;行号
  18.                         mov dl,0        ;列号
  19.                         mov si,0
  20.                         mov cx,21        ;大循环次数
  21.                        
  22.                        
  23.                         call input_show
  24.                        

  25.         mov ax,4c00h
  26.         int 21h       
  27.        
  28.         input_show:
  29.                         push si
  30.                         push dx
  31.                         push ax
  32.                         push bx
  33.                         push cx
  34.                         push di
  35.                         push bp
  36.                        
  37.                 input_show_s0:
  38.                         push cx
  39.                         mov bp,0                ;在数据段中的位置
  40.                         mov si,0
  41.                         mov al,160
  42.                         mul dh                        ;行号*160
  43.                         mov bx,ax                ;在显存中的行位置

  44.       call show_year                ;显示年份

  45.       call show_emplyer        ;显示人员

  46.       call show_income        ;显示收入

  47.       call show_wage                ;显示工资

  48.       inc dh
  49.       pop cx
  50.       loop input_show_s0

  51.       pop bp
  52.       pop di
  53.       pop cx
  54.       pop bx
  55.       pop ax
  56.       pop dx
  57.       pop si
  58.       ret

  59. ;----------------------------显示年代-------------------------------------

  60. show_year:

  61.      push si
  62.      push dx
  63.      push ax
  64.      push bx                           ;不能动
  65.      push cx
  66.      push di
  67.      push bp

  68.      mov al,4
  69.      mul dh                        ;确定显存位置已经结束,dx可用了
  70.      mov bp,ax                ;在数据段中进行移动
  71.            mov cx,4                ;年代循环次数
  72.            input_show_s1:
  73.            mov ax,[bp]
  74.            mov es:[bx+si],ax
  75.      mov ax,07h
  76.      mov es:[bx+si+1],ax
  77.      
  78.            inc bp
  79.            add si,2
  80.            loop input_show_s1
  81.                         
  82.             pop bp
  83.             pop di
  84.             pop cx
  85.             pop bx
  86.             pop ax
  87.             pop dx
  88.             pop si
  89.                         ret

  90. ;-------------------------人员--------------------------------


  91.   show_emplyer:
  92.      push si
  93.      push dx
  94.      push ax
  95.      push bx                           ;不能动
  96.      push cx
  97.      push di
  98.      push bp

  99.      mov al,2
  100.      mul dh                                                ;确定显存位置已经结束,dx可用了
  101.      mov bp,ax
  102.      mov ax,[bp+168]
  103.     ; mov ax,3
  104.      mov si,0

  105.    show_employer_s0:
  106.      mov cx,ax
  107.      jcxz show_employer_input
  108.      mov dx,0
  109.      mov bp,10
  110.      div bp
  111.      mov bp,ax
  112.      add dx,30h
  113.      mov ax,dx
  114.      push ax
  115.      mov ax,bp
  116.      inc si
  117.      jmp show_employer_s0
  118.    
  119.    show_employer_input:
  120.      mov cx,si
  121.      mov si,0
  122.    show_employer_s1:
  123.      pop ax
  124.      mov es:[bx+40+si],al
  125.      mov al,07h
  126.      mov es:[bx+41+si],al
  127.   
  128.      add si,2
  129.      loop show_employer_s1
  130.   
  131.      pop bp
  132.      pop di
  133.      pop cx
  134.      pop bx
  135.      pop ax
  136.      pop dx
  137.      pop si
  138.      ret
  139.   


  140. ;------------------        收入--------------       
  141.   show_income:
  142.      push si
  143.      push dx
  144.      push ax
  145.      push bx
  146.      push cx
  147.      push di
  148.      push bp
  149.    
  150.      mov al,4
  151.      mul dh
  152.      mov bp,ax
  153.      mov ax,[bp+84]
  154.      mov dx,[bp+86]
  155.      mov si,0
  156.    
  157.    show_income_s0:
  158.      mov cx,ax
  159.      jcxz show_income_input
  160.      push ax
  161.      mov ax,dx
  162.      mov dx,0
  163.      mov bp,10
  164.      div bp
  165.      mov di,ax
  166.      pop ax
  167.      div bp
  168.      mov bp,ax
  169.      add dx,30h
  170.      mov ax,dx
  171.      push ax
  172.      mov dx,di
  173.      mov ax,bp
  174.      inc si
  175.      jmp show_income_s0
  176.    
  177.    show_income_input:
  178.      mov cx,si
  179.      mov si,0
  180.    show_income_input_s1:
  181.      pop ax
  182.      mov es:[bx+si+20],al
  183.      mov al,07h
  184.      mov es:[bx+si+21],al
  185.      add si,2
  186.      loop show_income_input_s1
  187.   
  188.      pop bp
  189.      pop di
  190.      pop cx
  191.      pop bx
  192.      pop ax
  193.      pop dx
  194.      pop si
  195.      ret
  196. ;-------------------------人均收入---------------------------------------
  197.   show_wage:
  198.      push si
  199.      push dx
  200.      push ax
  201.      push bx
  202.      push cx
  203.      push di
  204.      push bp
  205.    
  206.      mov ax,4
  207.      mul dh
  208.      mov bp,ax                                ;确定公司总收入的位置
  209.    
  210.      mov ax,2
  211.      mul dh                                        ;确定显存位置已经结束,dx可用了
  212.      mov di,ax                                        ;确定公司人员的位置
  213.    
  214.      mov ax,[bp+84]
  215.      mov dx,[bp+86]
  216.      div word ptr [di+168]
  217.    
  218.      mov si,0
  219.    
  220.   show_wage_s0:
  221.      mov cx,ax
  222.      jcxz show_wage_input
  223.      mov dx,0
  224.      mov bp,10
  225.      div bp
  226.      mov bp,ax
  227.      add dx,30h
  228.      mov ax,dx
  229.      push ax
  230.      mov ax,bp
  231.      inc si
  232.      jmp show_wage_s0

  233.    show_wage_input:
  234.      mov cx,si
  235.      mov si,0
  236.   show_wage_s1:
  237.      pop ax
  238.      mov es:[bx+si+60],al
  239.      mov al,07h
  240.      mov es:[bx+si+61],al
  241.   
  242.      add si,2
  243.      loop show_wage_s1
  244.   
  245.      pop bp
  246.      pop di
  247.      pop cx
  248.      pop bx
  249.      pop ax
  250.      pop dx
  251.      pop si
  252.      ret

  253. ;------------------------------------------


  254. codesg ends
  255. end start
复制代码
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2024-5-11 00:51

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表