1、屏幕中央以@字符显示闪动(1HZ)霓虹灯,而后按W由两边向中央进行填充,按 后按相反的次序消失。按Q退出程序。 ;******设置光标位置的宏定义******* MA macro op1,op2 push ax ;保存数据 push bx mov ah,02h mov bh,0 mov dh,op1 ;光标横坐标 mov dl,op2 ;光标纵坐
2、标 int 10h pop bx pop ax endm data segment data ends code segment assume ds:data,cs:code ;******延时子程序******* waiting proc push ax ;保存数据 push cx push dx mov ah,2dh xor cx,cx xor dx,dx int 21h he
3、re: mov ah,2ch ;取时间 int 21h cmp dl,50 ;延时0.5秒 jb here pop dx pop cx pop ax ret waiting endp start: mov ax,data mov ds,ax xor ax,ax ;数据初始化 xor bx,bx x
4、or cx,cx xor dx,dx mov ah,06h ;屏幕初始化 mov bh,4ah ;卷入行属性 mov cx,0 ;左上角行列坐标(0,0) mov dx,5050h ;右下角行列坐标(80,80) int 10h mov ah,02h ;置光标位置
5、 mov bh,0 ;BH=页数 mov dh,100 ;DH/DL=行/列 mov dl,0 int 10h ;******显示'@'字符******* light: mov ch,40 MA 10,ch ;置光标位置 mov dl,'@' mov ah,02h ;显示输出'@' int 21h
6、 MA 100,0 call waiting ;延时 ;******'@'字符消失******* dark: MA 10,ch ;置光标位置 mov dl,' ' mov ah,02h ;显示输出字符' '并覆盖字符'@' int 21h MA 100,0 call waiting choice_1:
7、 ;检测是否有字符'W'/'w'的输入,有就 mov ah,1h 执行语句go,否则跳到语句light进行 int 16h 循环 cmp al,'w' je go cmp al,'W' je go jne light go:
8、 ;重新对CH/CL赋值 xor cx,cx mov ch,0 mov cl,79 ;******显示'@'字符并由两边向中间填充******* OUT_IN: call waiting MA 10,ch mov dl,'@' mov ah,02h ;左边显示输出'@' int 21h MA 10,cl mov dl,'@' mov ah,02h
9、 ;左边显示输出'@' int 21h inc ch ;CH加1 dec cl ;CL减1 MA 100,0 ;移除光标 cmp ch,40 ;比较'@'是显示否到中间 je change ;是,跳出并执行change语句 jm
10、p OUT_IN ;否,则继续 change: ;重新对CH/CL赋值 xor cx,cx mov ch,39 mov cl,40 choice_2: ;检测是否有字符'N'/'n'的输入,有就执 call waiting 行语句IN_OUT,否则跳到语句 mov ah,1h choic
11、e_2进行循环 int 21h cmp al,'n' je IN_out cmp al,'N' je IN_out jne choice_2 ;******消失'@'字符并由中间向两边消失******* IN_out: call waiting MA 10,ch mov dl,' ' mov ah,02h ;显示输出' ' int 21h MA
12、10,cl mov dl,' ' mov ah,02h ;显示输出' ' int 21h cmp ch,0 ;比较' '是否显示到两边 je choice_3 inc cl dec ch MA 100,0 cmp ch,0 ;是,跳出并执行choice_3语句 jmp IN_out
13、 ;否,则继续 choice_3: ;检测是否有字符'Q'/'q'的输入,有就执 mov ah,01h 行语句QUIT,否则继续等待 int 21h cmp al,'Q' je QUIT cmp al,'q' je QUIT jne choice_3 ;******中止程序******* QUIT: mov ah,4ch int 21h code ends end start






