寒假汇编语言作业(12)

程序设计项目十二

编写字符雨程序。参看demo6.gif示例。

提示:

(1)每列是一个单独的单元,在数据段中定义的数据要保证各列要显示的字符和开始显示的时机不一样。

(2)每一滴雨完全移出屏幕后,该雨滴所在列生成一个新的雨滴。

分析:

  题目的提示感觉不怎么明了,故就照着图和别人的代码写的代码。

参考代码:

效果感觉不咋地

  1 assume cs:code
  2 data segment
  3  db 0,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,1,0,0,1,0,1,0,0,0,0,1,0,1,0,0,0,0,0,0,0
  4  db 0,1,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,1,0,0,1,0,1,0,0,0,1,1,0,1,0,0,1,0,0,0,0
  5  db 0,1,0,0,0,0,0,0,0,1,1,1,0,0,0,1,0,0,0,0,1,0,0,1,0,1,0,0,0,1,1,0,1,0,0,1,1,0,0,0
  6  db 0,1,0,0,0,0,0,1,0,1,1,1,0,0,0,1,0,0,0,0,1,0,1,1,0,1,0,0,0,1,1,0,1,0,0,1,1,0,0,0
  7  db 0,1,0,0,0,0,0,1,0,1,0,1,0,0,0,1,0,0,0,0,1,0,1,0,0,1,0,0,0,1,1,0,1,0,1,1,1,0,0,0
  8  db 1,1,0,0,1,0,0,1,0,1,0,1,0,0,0,1,0,1,0,0,1,0,1,0,0,1,0,0,0,1,1,0,1,0,1,1,1,0,0,0
  9  db 1,1,0,0,1,0,0,1,0,1,0,1,0,0,0,1,0,1,0,0,1,0,1,0,0,1,0,0,0,1,0,0,1,0,1,1,1,0,0,0
 10  db 1,1,0,0,1,0,0,1,0,0,0,1,0,1,0,1,0,1,0,0,1,0,1,1,0,1,0,0,0,1,0,0,1,0,1,1,1,0,0,0
 11  db 1,1,0,0,1,0,0,1,0,0,0,1,0,1,0,1,0,1,0,0,1,0,1,1,0,1,0,0,0,1,0,1,1,0,1,1,1,0,0,0
 12  db 1,1,1,0,1,0,0,1,0,0,0,1,0,1,0,1,0,1,0,0,1,0,1,1,0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,1,1,0,1,0,0,1,0,0,0,0,0,0
 25  db 0,0,0,1,0,1,1,0,0,1,1,0,0,0,1,0,0,0,1,0,0,0,0,1,0,0,0,1,1,0,1,0,0,0,0,0,0,0,0,0
 26  db 0,0,0,1,0,1,1,0,0,1,1,0,0,0,1,0,0,0,1,0,0,0,0,1,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0
 27  db 0,0,0,1,0,1,1,0,0,1,1,0,0,0,1,0,0,0,1,0,0,0,0,1,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0
 28 data ends
 29
 30 stack segment
 31     dw 8 dup(0)
 32 stack ends
 33
 34 code segment
 35 start:
 36         mov ax,data
 37         mov ds,ax
 38         mov ax,0b800h
 39         mov es,ax
 40         mov di,0
 41         mov ax,stack
 42         mov ss,ax
 43         mov sp,10h
 44
 45         call clear_screen
 46         call draw_rain
 47
 48         mov cx,5h
 49     again:
 50         push cx
 51         call run_rain
 52         pop cx
 53         loop again
 54
 55         call over
 56
 57 run_rain:
 58         mov di,0
 59         mov cx,25
 60     rrs0:
 61         push cx
 62         push di
 63         mov cx,80
 64     rrs1:
 65         push cx
 66         push di
 67         mov ax,es:[di]
 68         mov cx,24
 69     rrs2:
 70         add di,160
 71         mov bx,es:[di]
 72         mov es:[di],ax
 73         mov ax,bx
 74         loop rrs2
 75         pop di
 76         mov es:[di],ax
 77         add di,2
 78         pop cx
 79         loop rrs1
 80         call sleep_1s
 81         pop di
 82         pop cx
 83         loop rrs0
 84         ret
 85
 86 draw_rain:
 87         mov di,0
 88         mov si,0
 89         mov bx,12h
 90         mov cx,25
 91     drs0:
 92         push cx
 93         push di
 94         mov cx,40
 95     drs1:
 96         mov al,ds:[si]
 97         cmp al,1
 98         jne drpass
 99         mov byte ptr es:[di],bl
100         mov byte ptr es:[di+1],02h
101         mov byte ptr es:[di+78],bh
102         mov byte ptr es:[di+79],02h
103         add bx,093h
104     drpass:
105         inc si
106         add di,2
107         loop drs1
108         pop di
109         add di,160
110         pop cx
111         loop drs0
112         ret
113
114 clear_screen:
115         push cx
116         push di
117         mov di,0
118         mov cx,25
119     cses0:
120         push cx
121         mov cx,80
122     cses1:
123         mov word ptr es:[di],0
124         add di,2
125         loop cses1
126         pop cx
127         loop cses0
128         pop di
129         pop cx
130         ret
131
132 sleep_1s:
133         push cx
134         mov cx,05h
135     sp10:
136         push cx
137         mov cx,0ffffh
138     sp11:
139         loop sp11
140         pop cx
141         loop sp10
142         pop cx
143         ret
144
145 over:
146         mov ax,4c00h
147         int 21h
148 code ends
149 end start

hj12.asm

时间: 2024-11-05 10:45:45

寒假汇编语言作业(12)的相关文章

寒假汇编语言作业(6)

程序设计项目六   在屏幕中间显示:“中华”两个字.参看demo0.png示例. 提示: 通过字模提取工具,可以提取字的显示信息. 分析: 跟lcd12864自定义图形差不多吧 直接用字模提取软件 参考代码: 1 assume cs:code 2 data segment 3 ; -- zhong -- 4 db 00h, 1Ch, 00h, 00h, 1Ch, 00h, 00h, 1Ch, 00h 5 db 00h, 1Ch, 00h, 00h, 1Ch, 00h, 1Fh,0FFh,0FCh

寒假汇编语言作业(9-10)

程序设计项目九 将ASCII码按顺序在屏幕上竖列显示.参看demo3.gif示例. 要求: (1)逐个显示字符,相邻的两个字符之间显示要有时间间隔. (2)字符颜色为绿色. (3)每列显示20个字符,列间距为5个字符.显示完128个ASCII码,共需7列. 参考代码: 1 assume cs:code 2 3 stack segment 4 dw 16 dup (0) 5 stack ends 6 7 code segment 8 start: 9 mov ax,0b800h 10 mov es

寒假汇编语言作业(4)

程序设计项目四 编程计算x(x>2)的y(y>2)次方.使用add指令实现. 另,若学到第10章,使用两种方式实现: (1)只使用add指令实现: (2)只使用mul指令实现: 并将计算式显示在屏幕中央. 例如: 计算4的3次方.在屏幕中央显示格式如下: 4 ^ 3 ----- 64 注意:结果不能超过16位寄存器可存储的最大值. 参考代码:

寒假汇编语言作业(5)

程序设计项目五 定义一个数据段如下: data segment db '[email protected]#O*&^[email protected]$% %$T1O m33E44E55t y77O88u!()' db '?' data ends 注意:第一行字符串为待处理的数据,'?'为字符串结束符号. 设计程序完成如下操作: (1)去掉除字母.空格.'!'之外的字符: (2) 通过内存间的数据交换,将数据段中的字符串修改为'Hello!Nice to meet you!': (3)在屏幕正中

3.28日第七次作业12章沟通管理13章合同管理

3.28日第七次作业12章沟通管理13章合同管理   第12章.项目沟通管理   1.项目沟通管理包括哪些过程?(记)P349 答:1).沟通计划编制 2).信息分发 3).绩效报告 4).项目干系人管理 2.阻碍有效沟通的因素有哪些?P351-352 答:1).沟通双方的物理距离 2).沟通的环境因素 3).缺乏清晰的沟通渠道 4).复杂的组织结构 5).复杂的技术术语 6).有害的态度 3.沟通计划编制的第一步是什么?目的是什么?P353 答:沟通计划编制的第一步是干系人分析.其目的是得出项

软件工程个人作业12

软件工程个人作业12 程序题目: •三人行设计了一个灌水论坛.信息学院的学生都喜欢在上面交流灌水,传说在论坛上有一个“水王”,他不但喜欢发帖,还会回复其他ID发的每个帖子.坊间风闻该“水王”发帖数目超过了帖子数目的一半. •如果你有一张当前论坛的帖子(包括回帖)列表,其中帖子的作者的ID也在其中,你能快速的找到这个传说中的水王吗? 一.设计思想 根据“水王”发帖数目超过了帖子数目的一半,通过寻找发帖数过半的ID找出“水王”. 二.源代码: 1 package finding; 2 3 impor

汇编语言 实验12

1 assume cs:code 2 3 code segment 4 start: 5 mov ax,code 6 mov ds,ax 7 mov si,offset do0 8 mov ax,0 9 mov es,ax 10 mov di,200h 11 mov cx,offset do0end-offset do0 12 cld 13 rep movsb 14 15 mov ax,0 16 mov ds,ax 17 mov word ptr ds:[0],200h 18 mov word

丛铭俣 160809324 (作业12)

#include<stdio.h> struct student { char no[10]; char name[20]; int age; char sex[4]; char tel[12]; char apa[50]; int grade; }; int main() { student class3[31]; int i; for(i=0;i<31;i++) scanf("%s%s%d%s%s%s%d",class3[i].no,class3[i].name,

作业12总结

一.知识点总结:1.字符串的输入:(1) scanf("%s",str); /*输入参数:字符数组名,不加地址符. 遇到回车或空格输入结束,并自动将输入的一串字符和'\0'送入数组中*/ //例: #include<Stdio.h> int main() { char str[80]; scanf("%s",str); printf("%s",str); return 0; } (2) gets(str) /*遇到回车输入结束,自动将