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

📄 move.asm

📁 输入一个字符串,回车后,该字符串变成蓝底黄字,且在屏幕移动碰到边缘弹回,一直这样持续下去,直到有按键退出.
💻 ASM
字号:
 stack  segment
db	200 dup (0)
stack  ends

data segment
temp	db	?

string	 db	 20 dup(?)
keyinput	db 'Please input English words from keyborad you want to move:$'
data ends

code segment
	 assume cs:code,ds:data,es:data
main	 proc	 far
	push 	ds
     	sub	 ax,ax
     	push 	ax
     	mov	 ax,data          ;初始化DS
     	mov 	ds,ax
     	mov 	es,ax
	mov	ah,0
	mov	al,3
	int	10h
	mov	 si,0
     	mov	 di,0
     	lea 	dx,keyinput
     	mov	 ah,9h
     	int	 21h
k:   
     	mov 	ah,1
    	 int	 21h
    	 cmp 	al,0dh
    	 je	 p
     	inc	 si
 	
    	mov 	string[di],al
    	 inc	di
     	 cmp 	di,25
   	 jl 	 k
p: 
	call	move	
    	mov 	ah,4ch
    	 int 	21h 
     	ret
main endp



display 	proc	 near
    	push bx
   	push ax
	mov	bp,seg string
	mov	es,bp
	mov	bp,offset string
	mov	cx,si
	
	mov	bl,1eh
	
	mov	ah,13h
	int	10h
   
     	call	 delay
    	call 	clear_screen    
  
    	pop 	ax
     	pop 	bx
     	ret
display endp

clear_screen 	proc 	near    ;清屏子程序
    	push 	ax              ;保护寄存器
     	push 	bx
     	push 	cx
     	push 	dx
    	mov 	ah,6             ;屏幕上卷功能
     	mov 	al,0
    	mov 	ch,0             ;左上角行号
     	mov 	cl,0             ;左上角列号
     	mov 	dh,24           ;右下角行号
     	mov 	dl,79           ;右下角列号
    	 mov 	bh,7             ;卷入行属性
     	int 	10h              ;调用显示功能
    	pop 	dx              
     	pop 	cx
     	pop 	bx
     	pop 	ax
    	ret                 
clear_screen endp

delay 	proc 	near         ;延时子程序
     	push 	cx
     	push 	dx
     	mov 	dx,50000
d11:	mov 	cx,800
	loop	$
     	dec 	dx

   	 jnz 	d11
     	pop 	dx
     	pop 	cx
     	ret
delay endp

move	proc	near
		
 case1:	
	cmp	dh,24
	jge	case2
	inc	dh
	
	inc	dl
	
	cmp	dl,73
	jge	case3
	
	mov	ah,2
	int	10h
	mov	al,1
	call	display
	mov	ah,1
	int	16h
	jnz	exit
	jmp	case1


case2:	
	dec	dh
	cmp	dh,0
	je	case3
	
	cmp	dl,0
	je	case4
	dec	dl
	mov	ah,2
	int	10h
	mov	al,0
	call	display
	mov	ah,1
	int	16h
	jnz	exit
jmp	case2

case3:		
	cmp	dh,24
	jge	case2
	inc	dh
	cmp	dl,0
	je	case1
	dec	dl
	mov	ah,2
	int	10h
	mov	al,0
	call	display
mov	ah,1
	int	16h
	jnz	exit
	jmp	case3

case4:	
	cmp	dl,0
	je	case1
	dec	dl
	cmp	dh,24
	je	case2
	inc	dh
	mov	al,1
	call	display
	mov	ah,1
	int	16h
	jnz	exit
	jmp	case4

exit:	ret
move	endp

code ends
     end main

⌨️ 快捷键说明

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