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

📄 ha.asm

📁 汇编语言的一些源码,全部都运行通过.课程设计的时候搞的.
💻 ASM
字号:
data	segment	para	'data'
string	label	byte
   	max	db	80
   	act	db	?
str		db	80 dup(?)
letters	db	00h
digits	db	00h
others	db	00h
mess1	db	'please enter a string:','$'
mess2	db	'You have inputed the letters:','$'
mess3	db	'You have inputed the digits:','$'
mess4	db	'You have inputed other chars:','$'
data	ends

code	segment	para	'code'
main    proc    far
	assume cs:code,ds:data,es:data 	
start:	push	ds
	   sub	ax,ax
	   push	ax
		mov	ax,data
      mov     ds,ax
		mov	es,ax
		lea	dx,mess1
		mov	ah,09h
		int	21h
		lea	dx,string
		mov	ah,0ah
		int	21h
		cmp	act,0
		jne	follow
		jmp	exit
follow:	
mov	letters,00h
		mov	digits,00h
		mov	others,00h
      call	crlf
		sub   cx,cx
		mov	cl,act
		lea	di,str
lable:	
mov	ax,[di]
		cmp	al,30h		
		jb	other		;x<30,other+1
		cmp	al,3ah
		jb	digit		;30=<x<3a,digit+1
		cmp	al,41h
		jb	other		;3a=<x<41,other+1
		cmp	al,5bh
		jb	letter		;41=<x<5b,letter+1
		cmp	al,61h
		jb	other		;5b=<x<61,other+1
		cmp	al,7bh
		jb	letter		;61=<x<7b,letter+1
		jmp	other		;then other+1
yy:
loop	lable	
		jmp	output
digit:	
add	digits,1
		inc	di
		jmp	yy
letter:	
add	letters,1
		inc	di
		jmp	yy
other: 
		add	others,1
		inc	di
		jmp	yy		
output:
		lea	dx,mess2
		mov	ah,09h
		int	21h
		mov	bl,letters
		call	printn
		call	crlf
		lea	dx,mess3
		mov	ah,09h
		int	21h
		mov	bl,digits
		call	  	printn
		call		crlf
		lea		dx,mess4
		mov	ah,09h
		int		21h
		mov	bl,others
		call		printn
		call		crlf
		jmp	start
printn	proc	near
		mov	ch,2
rotate:	
mov	cl,4
		rol	bl,cl
		mov	al,bl
		and	al,0fh
		add	al,30h
		cmp	al,3ah
		jl	printit
		add	al,7h
printit:	
		mov	dl,al
		mov	ah,02h
		int	21h
		dec	ch
		jnz	rotate
		ret
printn	endp
crlf		proc	near
		mov	dl,13
		mov	ah,02h
		int	21h
		mov	dl,10
		mov	ah,02h
		int	21h
ret
crlf	endp
exit:
		mov	ax,4c00h
		int	21h
main	endp
code	ends
end	start

⌨️ 快捷键说明

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