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

📄 count.asm

📁 计算机汇编实验:表格显示字符
💻 ASM
字号:
dseg segment
	inf0    db  'input a string:$'
    inf1    db 'Letters: $'
    inf2    db 'Digits: $'
    inf3    db 'Others: $'
	stringin label 	byte
	maxlens  db  80
	lens	 db	 ?
	string	 db  80 dup(0)
	
	compart  db  80 dup(23h),'$'
	
	lenl     dw  0
	letter   db  80 dup(0)

	lend     dw  0
	digit    db  80 dup(0)
	
    leno     dw  0
    other    db  80 dup(0)
dseg ends
	
code segment
	assume cs:code,	ds:dseg, es:dseg
	main proc far
	start:
	push ds
	sub ax,ax
	push ax
	
	mov ax, dseg
	mov ds, ax
	mov es, ax
	
	call input
	call class
	call show
	ret
	main endp
	
	input proc near
		mov ah, 09h
		lea dx, inf0
		int 21h
		mov ah, 0ah
		lea dx, stringin
		int 21h
		call newLine
		ret
	input endp
	
	class proc near
		sub si, si
		mov cl, lens
	next:
		push si
		mov dl, string[si]
		cmp dl, 30h
		js to_other

		cmp dl, 3ah
		js to_digit

		cmp dl, 41h
		js to_other

		cmp dl, 5bh
		js to_letter

		cmp dl, 61h
		js to_other

		cmp dl, 7bh
		js to_letter
		
	to_other:
		mov si, leno
		mov other[si], dl
		inc leno
		jmp last
		
	to_letter:
		mov si, lenl
		mov letter[si], dl
		inc lenl
		jmp last
		
	to_digit:
		mov si, lend
		mov digit[si], dl
		inc lend

	last:
		pop si
		inc si
		dec cl
		cmp cl, 00h
		jnz next
		mov si,lenl
		mov letter[si], '$'
		mov si,lend
		mov digit[si], '$'
		mov si,leno
		mov other[si], '$'
		ret
	class endp
	
	show proc near
		mov ah, 09h
		lea dx, inf1
		int 21h
		mov ah, 09h
		lea dx, letter
		int 21h
		call newLine
		
		mov ah, 09h
		lea dx, inf2
		int 21h
		mov ah, 09h
		lea dx, digit
		int 21h
		call newLine
		
		mov ah, 09h
		lea dx, inf3
		int 21h
		mov ah, 09h
		lea dx, other
		int 21h
		call newLine
		ret
	show endp
	
	newLine proc near
		mov dl, 0dh
		mov ah, 02h
		int 21h
		mov dl, 0ah
		mov ah, 02h
		int 21h
		lea dx, compart
		mov ah, 09h
		int 21h
		mov dl, 0dh
		mov ah, 02h
		int 21h
		mov dl, 0ah
		mov ah, 02h
		int 21h
		ret
    newLine endp
	
code ends
end start
	

⌨️ 快捷键说明

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