首页 > 代码库 > 寒假汇编语言作业(9-10)

寒假汇编语言作业(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,0b800h10         mov es,ax11         mov ax,stack12         mov ss,ax13         mov sp,20h14         mov dh,02h15         mov dl,016         mov di,28017         mov cx,718     s0:19         push cx20         push di21         mov cx,2022      s1:23         mov es:[di],dx24         cmp dl,12725         je over26         inc dl27         add di,16028         call sleep29         loop s130         pop di31         sub di,1032         pop cx33         loop s034         jmp over35 36  sleep:37         push cx38         mov cx,239      ssl:40         push cx41         mov cx,0ffffh42      ssl1:43         loop ssl144         pop cx45         loop ssl46         pop cx47         ret48 49  over:50         mov ax,4c00h51         int 21h52 code ends53 end start
hj9.asm

 

程序设计项目十

 

在屏幕上斜着显示三个‘happy spring festival!’,字符串的颜色分别为蓝色、绿色和红色,并且各个字符串的颜色按规律变换。参看demo4.gif示例。

 

技术分享

 

参考代码:

技术分享
 1 assume cs:code 2  3 data segment 4         db happy spring festival!  5         db  01h,02h,04h,01h,02h 6 data ends 7  8 stack segment 9         dw 8 dup (0)10 stack ends11 12 code segment13 start:14         mov ax,data15         mov ds,ax16         mov ax,0b800h17         mov es,ax18         mov ax,stack19         mov ss,ax20         mov sp,10h21     again:22         mov si,023         mov bp,2324         mov di,50025         mov cx,326      main:27         push cx28         push si29         push di30         mov cx,2331      s0:32         mov al,ds:[si]33         mov ah,ds:[bp]34         mov es:[di],ax35         mov ah,ds:[bp+1]36         mov es:[di+6],ax37         mov ah,ds:[bp+2]38         mov es:[di+12],ax39         add di,16440         inc si41         loop s042 43         inc bp44         call sleep45         pop di46         pop si47         pop cx48         loop main49 50     ;    jmp again51         jmp over52 53 sleep:54         push cx55         mov cx,2056      sslp:57         push cx58         mov cx,0ffffh59      ssl:60         loop ssl61         pop cx62         loop sslp63         pop cx64         ret65 66 over:67         mov ax,4c00h68         int 21h69 code ends70 end start
hj10.asm

 

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