21,458
社区成员
发帖
与我相关
我的任务
分享
;
;This Program Compiled Sucess by Masm 6.15
;
assume cs:code,ds:data
data segment
msg db 'Enter a string:$'
buffer db 80,0,80 dup (0)
_number db 0
_cap db 0
_low db 0
_other db 0
nummsg db 'numbers of digit:$'
capmsg db 'numbers of cap-letter:$'
lowmsg db 'numbers of low-letter:$'
othmsg db 'numbers of other-char:$'
data ends
code segment
start:
mov ax,data
mov ds,ax
mov dx,offset msg
mov ah,9
int 21h
mov dx,offset buffer
mov ah,10
int 21h
call crlf
mov bx,offset buffer+2
mov cl,buffer+1
s:
mov al,[bx]
cmp al,'0'
jae sz
jmp oth
sz:
cmp al,'9'
jbe num
jmp zm
num:
inc _number
jmp jx
zm:
cmp al,'A'
jae zm0
jmp oth
zm0:
cmp al,'Z'
jbe zm1
jmp zm2
zm1:
inc _cap
jmp jx
zm2:
cmp al,'a'
jae zm3
jmp oth
zm3:
cmp al,'z'
jbe zm4
oth:
inc _other
jmp jx
zm4:
inc _low
jx:
inc bx
loop s
mov dx,offset nummsg
mov ah,9
int 21h
mov dl,_number
call disp
call crlf
mov dx,offset capmsg
mov ah,9
int 21h
mov dl,_cap
call disp
call crlf
mov dx,offset lowmsg
mov ah,9
int 21h
mov dl,_low
call disp
call crlf
mov dx,offset othmsg
mov ah,9
int 21h
mov dl,_other
call disp
mov ah,4ch
int 21h
;crlf
crlf proc uses ax dx
mov ah,2
mov dl,13
int 21h
mov dl,10
int 21h
ret
crlf endp
;
;input:dx
disp proc uses dx
mov ax,dx
xor dx,dx
mov bx,10
mov cx,0
d2: cmp ax,10
jb ok2
div bx
add dl,30h
push dx
xor dx,dx
inc cx
jmp d2
ok2: add al,30h
push ax
inc cx
d3: pop dx
mov ah,2
int 21h
loop d3
ret
disp endp
;
code ends
end start