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

📄 count_char.asm

📁 IBM_PC汇编语言程序设计实验教程中第2章全部5个实验,smascii,search,count_char,phone,fibonacci.
💻 ASM
字号:
data segment

letter db 0
digit db 0
other db 0
temp db 0

mess1 db 'plese input the string:','$'
mess2 db 'you have not input data!','$'
mess3 db 'the total number of letters is:',20h,'$'
mess4 db 'the total number of digit is:',20h,'$'
mess5 db 'the total number of other char is:',20h,'$'
enter db 13,10,'$'

strin label byte
max     db    80
act     db    ?
str   db    80 dup(?)

data ends
code segment
     assume cs:code,ds:data
start:
     mov ax,data
     mov ds,ax
     mov es,ax

     lea dx,mess1
     mov ah,09
     int 21h
     lea dx,strin
     mov ah,0ah
     int 21h



     lea dx,enter
     mov ah,09
     int 21h
cmp act,0
je loog0

     mov cl,act
     mov ch,0

     lea si,str
loog:
     mov al,[si]
     cmp al,'a'
     jb  loog1
     cmp al,'z'
     ja  loog3
     inc letter
     jmp loog4
 loog0:
lea dx,mess2
     mov ah,09
     int 21h
mov ah,4ch
int 21h
loog1:
     cmp al,'A'
     jb loog2
     cmp al,'Z'
     ja loog3
     inc letter
     jmp loog4
loog2:
     cmp al,'0'
     jb loog3
     cmp al,'9'
     ja loog3
     inc digit
     jmp loog4
loog3:
     inc other
loog4:
     inc si
     loop loog

     lea dx,mess3
     mov ah,09
     int 21h
	 mov al,letter
	 lea di,temp
	 call subr1

     lea dx,mess4
     mov ah,09
     int 21h
     mov al,digit
     lea di,temp
     call subr1
     
     lea dx,mess5
     mov ah,09
     int 21h
     mov al,other
     lea di,temp
     call subr1

     mov ah,4ch
     int 21h
subr1 proc near
mov cx,0
loog5:
mov ah,0
mov bl,10
div bl
mov dl,ah
     add dl,30h
     push dx
     inc cx
cmp al,0
jne loog5 
loog6:
pop ax
stosb
dec cx
cmp cx,0
jne loog6
mov al,'$'
stosb
lea dx,temp
mov ah,09
int 21h
     lea dx,enter
     mov ah,09h
     int 21h
ret
subr1 endp

code ends
      end start

   

⌨️ 快捷键说明

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