⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 h.asm

📁 用汇编实现的画出动画心的功能、点任意键刷新一次
💻 ASM
字号:
data segment;定义数据段
full db 0
buff1 db '   Welcome you to run this programme!'  
      db '                                     '
      db '           *****Please press any key*****$'
buff2 db '       My heart beats with yours!'
      db '             ***** Please q to quit *****$'
data ends

code segment
main proc far
     assume cs:code,ds:data
start:
     push ds    
     sub ax,ax
     push ax
     mov ax,data;装填数据段
     mov ds,ax
     mov ah,00
     mov al,04
     int 10h  ;bios int 10h 功能调用
     mov ah,0bh;置彩色调色板
     mov bh,00  ;置背景色
     mov bl,1;1为蓝色像素代码
     int 10h   
     mov ah,0bh
     mov bh,1 ;选调色板
     mov bl,2  ;2号调色板
     int 10h
     mov dx,offset buff1               ;显示提示信息
     mov ah,09   ;9号功能调用输出
     int 21h
     mov ah,08  ;读光标位置的字符及属性
     int 21h
     call clear                        ;cls
sss:
     call text                         ;display the text
     mov di,2
     mov al,1                          ;draw the big box
     mov cx,70
     mov dx,20
     mov bx,160
     call box       ;划最外围的框
     
  draw_Line proc near               ;the procedure of draw a line
push bx      ;保存bx值
cmp si,0
jz V_line1     ;等于0时转
add bx,cx
H_line:

mov ah,0ch    ;根据cx的不同值划出一行不同列的像素点
int 10h
cmp di,0
jz aa0
cmp di,1
jz aa1
call delay
aa1:

call delay
aa0:

inc cx  ;划出cx-bx位置的像素点
cmp cx,bx   ;跳转执行bx-cx次 
jne H_line  
jmp exit_line
V_line1:

add bx,dx
V_line:

mov ah,0ch
cmp di,0
jz bb0
cmp di,1
jz bb1
call delay;延迟
bb1:

call delay
bb0:

int 10h
inc dx ;划出dx-bx位置的点
cmp dx,bx;跳转执行bx-dx次
jne V_line
exit_line: ;恢复bx值

pop bx
ret
draw_Line endp
  
  box proc near                      ;draw a box
push cx
push dx
push cx
push dx
push cx
push dx
push cx
push dx              
mov si,1
call draw_line                    ;划顶线dx处的横线top
pop dx
pop cx
add cx,bx
mov si,0
call draw_line                     ;划右边cx+bx列的竖线right
pop dx
pop cx
mov si,0
call draw_line                    ;划cx位置的竖线left
pop dx
pop cx
mov si,1
add dx,bx
call draw_line                    ;划dx=180位置的横线bottom
pop dx
pop cx
ret
box endp


text proc near                    ;显示文本信息
mov bh,0  ;光标所在页
mov dh,0 ;光标所在行
mov dl,0  ;光标所在列
mov ah,2  ;置光标位置
int 10h
mov dx,offset buff2   ;DX指向首地址
mov ah,09     ;9号功能调用
int 21h
text endp
clear proc near                   ;clear
mov al,0;al=色彩代码
mov bx,0
mov cx,0;cx=点所在列
mov dx,0;dx=点所在行
line:

mov ah,0ch  ;写像素点
int 10h
inc cx  
cmp cx,320;
jne line  ;不等320时转
mov cx,0;cx置零
inc dx  ;点到下一行
cmp dx,200
jne line ;不等200时转
ret    ;用过程返回DOS的标准序
clear endp
code ends
end start

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -