📄 2-3.asm
字号:
dataseg segment
buffer db 80
size1 db ?
store db 80 dup(?)
message1 db 'Input the string:',0ah,0dh,'$'
message2 db 'Number of char:','$'
message3 db 0ah,0dh,'Number of figure:','$'
message4 db 0ah,0dh,'Number of another:','$'
s1 dw ?
s2 dw ?
s3 dw ?
dataseg ends
;--------------------------code segment-----------------------
countchar segment
main proc far
assume cs:countchar,ds:dataseg
start:
push ds
sub ax,ax
push ax
mov ax,dataseg
mov ds,ax
mov dx,offset message1
mov ah,09h
int 21h
mov dx,offset buffer
mov ah,0ah
int 21h
mov di,offset store
mov s1,0
mov s2,0
mov s3,0
next:
mov al,[di]
and ax,0ffh
cmp ax,0dh
jz exit
cmp ax,30h
jc next3
cmp ax,3ah
jc next2
cmp ax,41h
jc next3
cmp ax,5bh
jc next1
cmp ax,61h
jc next3
cmp ax,7bh
jc next1
jmp next3
next1:
inc s1
jmp next4
next2:
inc s2
jmp next4
next3:
inc s3
next4:
inc di
jmp next
exit:
mov dx,offset message2
mov ah,09h
int 21h
mov bx,s1
call binihex
lea dx,message3
mov ah,09h
int 21h
mov bx,s2
call binihex
mov dx,offset message4
mov ah,09h
int 21h
mov bx,s3
call binihex
ret
main endp
;--------------------------display the number of--------------
binihex proc near
mov ch,4
rotate:
mov cl,4
rol bx,cl
mov al,bl
and al,0fh
add al,30h
cmp al,3ah
jl printit
add al,7h
printit:
mov dl,al
mov ah,2
int 21h
dec ch
jnz rotate
ret
binihex endp
countchar ends
end start
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -