zoukankan      html  css  js  c++  java
  • 寒假汇编语言作业(11)

    程序设计项目十一

    动态画出一个棵七彩圣诞树。参看demo5.gif示例。

    参考代码:

    画树的代码感觉想到有两种,一种是向下面写的一样

    另一种是把这个路线保存下来,然后循环添加的他的路线 

      1 assume cs:code
      2 
      3 data segment
      4         db 'ACEGIKMOQSUWY13579BD'
      5         db 'BDFHJLNPRTVXZ2468ACE'
      6 data ends
      7 
      8 stack segment
      9         dw 8 dup(0)
     10 stack ends
     11 
     12 code segment
     13 start:
     14         mov ax,data
     15         mov ds,ax
     16         mov ax,0b800h
     17         mov es,ax
     18         mov ax,stack
     19         mov ss,ax
     20         mov sp,10h
     21         
     22         call clear_screen
     23         call greenground
     24         call draw_chrismastree
     25         call over
     26 
     27 draw_chrismastree:
     28         mov di,80
     29         mov ah,31
     30         mov al,'*'
     31         call draw
     32         mov cx,7
     33     dxt0:
     34         add di,156
     35         call draw
     36         loop dxt0
     37         mov cx,6
     38     dxt1:
     39         add di,4
     40         call draw
     41         loop dxt1
     42         mov cx,10
     43     dxt2:
     44         add di,156
     45         call draw
     46         loop dxt2
     47         mov cx,10
     48     dxt3:
     49         add di,4
     50         call draw
     51         loop dxt3
     52         mov cx,7
     53     dxt4:
     54         add di,160
     55         call draw
     56         loop dxt4
     57         mov cx,3
     58     dxt5:
     59         add di,4
     60         call draw
     61         loop dxt5
     62         mov cx,7
     63     dxt6:
     64         sub di,160
     65         call draw
     66         loop dxt6
     67         mov cx,10
     68     dxt7:
     69         add di,4
     70         call draw
     71         loop dxt7
     72         mov cx,10
     73     dxt8:
     74         sub di,164
     75         call draw
     76         loop dxt8
     77         mov cx,6
     78     dxt9:
     79         add di,4
     80         call draw
     81         loop dxt9
     82         mov cx,8
     83     dxt10:
     84         sub di,164
     85         call draw
     86         loop dxt10
     87         ret
     88 
     89 draw:
     90         add ah,12
     91         mov es:[di],ax
     92         call sleep_1s
     93         ret
     94 
     95 greenground:
     96         mov di,0
     97         mov bp,3844
     98         mov cx,25
     99     gg0:
    100         push cx
    101         mov ah,02h
    102         mov si,0
    103         mov bx,20
    104         mov cx,20
    105     gg1:
    106         mov al,ds:[si]
    107         mov es:[di],ax
    108         mov al,ds:[bx]
    109         mov es:[bp],ax
    110         add di,8
    111         add bp,8
    112         inc si
    113         inc bx
    114         loop gg1
    115         call sleep_1s
    116         sub bp,320
    117         pop cx
    118         loop gg0
    119         ret
    120 
    121 sleep_1s:
    122         push cx
    123         mov cx,8h
    124     sps0:
    125         push cx
    126         mov cx,0ffffh
    127     sps1:
    128         loop sps1
    129         pop cx
    130         loop sps0
    131         pop cx
    132         ret
    133 
    134 clear_screen:
    135         push cx
    136         push di
    137         mov di,0
    138         mov cx,25
    139     cses0:
    140         push cx
    141         mov cx,80
    142     cses1:
    143         mov word ptr es:[di],0
    144         add di,2
    145         loop cses1
    146         pop cx
    147         loop cses0
    148         pop di
    149         pop cx
    150         ret
    151 
    152 over:
    153         mov ax,4c00h
    154         int 21h
    155 code ends
    156 end start
    hj11.asm
  • 相关阅读:
    子序列自动机
    poj 暴力水题
    小白贪心题
    组合数+费马大/小定理
    随机数法
    vector的二维用法+前缀和
    巨思维题
    思维水题
    Codeforces Round #323 (Div. 2) D.Once Again... (nlogn LIS)
    Codeforces Round #325 (Div. 2) D. Phillip and Trains (BFS)
  • 原文地址:https://www.cnblogs.com/regconfi/p/4274718.html
Copyright © 2011-2022 走看看