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

📄 qiche.asm

📁 汇编课程设计......................汽车
💻 ASM
字号:
;***************************动画程序************************* 

;********************设置汽车公路的相关数据****************** 
data segment 
  car  db 5 dup(20h) ;汽车图形数据 
dw 0dbdbh 
db 154 dup(20h) 
dw 0dbdbh 
db 20h 
dw 0dbdbh 
db 20h 
dw 0dbdbh 
db 20h 
dw 0dbdbh 
db 151 dup(20h),4fh,5 dup(20h),4fh 

  lencar  dw 330 ;汽车显示总长度 

road  dw 80 dup(01616h) ;公路图形数据 
lenroad db 80 ;公路显示总长度 
data ends 
;************************************************************** 


;**************************程序代码区************************** 
code segment 
 assume cs:code,ds:data 
start: mov ax,data ;程序开始 
  mov ds,ax 
  lea bp,car ;将汽车数据传给显示入口 
  mov es,ax 
  mov cx,69d ;69祯画面 
  mov dh,6d ;第6行 
  mov dl,00h ;第0列 
s0:  ;动画 
call cardisplay ;画汽车 
  inc dl ;向后移一列 
call delay ;停留一小段时间 
  loop s0 ;如果没到第69祯,继续画 
exit: ;返回DOS 
  mov ax,4c00h 
  int 21h 


;**************************显示汽车子程序********************** 
cardisplay proc near 
call clear ;清屏 
push dx 
push cx 
  mov cx,lencar  ;设置显示汽车长度 
  mov bh,00h  ;第0页 
  mov bl,0f9h ;白色背景(f) 蓝色前景(9) 
  mov ax,1301h ;显示汽车 
  int 10h  
  pop cx 
pop dx 
ret 
cardisplay endp 
;************************************************************** 

;***************************清屏子程序************************* 
clear proc near 
  push ax ;保存寄存器内容 
  push bx 
  push cx 
  push dx 
push bp 
push es 

  mov ax,0600h  ;ah=06(滚动) al=00(全屏空白) 
  mov bh,0f0h  ;黑色背景(0) 白色前景(f) 
  sub cx,cx  ;左上角行:列  
  mov dx,184fh  ;右下角行:列 
  int 10h 
  mov dh,11d ;第11行 
call roaddisplay 
mov dh,12d ;第12行 
call roaddisplay 
pop es ;恢复寄存器内容 
pop bp 
  pop dx 
  pop cx 
  pop bx 
  pop ax 
  ret 
clear endp 
;**************************************************************  

;**************************显示子程序2*************************  
roaddisplay proc near 
mov ax,data 
  mov ds,ax 

  lea bp,road ;将公路数据传给显示入口 
  mov es,ax 

  mov dl,00h ;第0列 
  mov ch,00h 
  mov cl,lenroad  ;设置显示公路长度 
  mov bh,00h  ;第0页 
  mov bl,0f5h  ;白色背景(f) 棕色前景(9) 
  mov ax,1301h ;显示公路 
  int 10h 
ret  
roaddisplay endp 
;************************************************************** 

;***************************延时子程序************************* 
delay proc 
  push cx ;保存寄存器内容 
  push dx  
  
  mov dx,0fffh 
 up:  xor cx,cx  ;延时  
 a: loop a 
  dec dx  
  jnz up 
pop dx ;恢复寄存器内容 
  pop cx 
  ret ;返回 
delay endp 
;************************************************************** 

code ends 
 end start ;程序结束 
;************************************************************** 

⌨️ 快捷键说明

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