Q> Write an assembly language program to read string, count no.
uppercase character,lowercase character, digits and other character
present in the string in a clear screen
Entered string-We pay 13% VAT.
Uppercase character-4
Lowercase character-10
Digits-2
Others-7
title dispaly
.model small
.stack 64h
.data
maxchar db 50h
actchar db ?
arr db 50h dup (?)
count db 4h dup (0)
temp db 3h dup (?)
request db 'enter a string',0ah,0dh,'$'
enter db 'entered string-','$'
upper db 0ah,0dh,'Upper Characters-','$'
lower db 0ah,0dh,'Lower characters-','$'
digits db 0ah,0dh,'Digits-','$'
others db 0ah,0dh,'Others-','$'
.code
display proc
mov si,00h
mov dh,0ah
mov ah,00h
mov al,count[di]
Rediv:div dh
add ah,30h
mov temp[si],ah
inc si
mov ah,00h
cmp al,00h
jne Rediv
mov ah,02h
Nxt:dec si
mov dl,temp[si]
INT 21H
cmp si,00h
jne Nxt
ret
display endp
main proc
mov ax,@data
mov ds,ax
mov ah,09h
lea dx,request
int 21h
mov ah,0ah
lea dx,maxchar
int 21h
mov ch,00h
mov cl,actchar
mov di,00
start:cmp arr[di],'a'
jb upp
cmp arr[di],'z'
jbe sma
inc count[3]
jmp skip
sma: inc count[1]
jmp skip
upp: cmp arr[di],'A'
jb dig
cmp arr[di],'Z'
jbe upp1
inc count[3]
jmp skip
upp1: inc count[0]
jmp skip
dig: cmp arr[di],'0'
jb oth
cmp arr[di],'9'
jbe dig1
oth: inc count[3]
jmp skip
dig1: inc count[2]
skip: inc di
loop start
mov arr[di],'$'
mov ax,0600h
mov bh,07h
mov cx,0000h
mov dx,184Fh
int 10h
mov ah,02h
mov bh,00h
mov dx,00h
int 10h
mov ah,09h
lea dx,enter
int 21h
lea dx,arr
int 21h
lea dx,upper
int 21h
mov di,00
call display
mov ah,09h
lea dx,lower
int 21h
mov di,01
call display
mov ah,09h
lea dx,digits
int 21h
mov di,02
call display
mov ah,09h
lea dx,others
int 21h
mov di,03
call display
mov ax,4c00h
int 21h
main endp
end main
uppercase character,lowercase character, digits and other character
present in the string in a clear screen
Entered string-We pay 13% VAT.
Uppercase character-4
Lowercase character-10
Digits-2
Others-7
title dispaly
.model small
.stack 64h
.data
maxchar db 50h
actchar db ?
arr db 50h dup (?)
count db 4h dup (0)
temp db 3h dup (?)
request db 'enter a string',0ah,0dh,'$'
enter db 'entered string-','$'
upper db 0ah,0dh,'Upper Characters-','$'
lower db 0ah,0dh,'Lower characters-','$'
digits db 0ah,0dh,'Digits-','$'
others db 0ah,0dh,'Others-','$'
.code
display proc
mov si,00h
mov dh,0ah
mov ah,00h
mov al,count[di]
Rediv:div dh
add ah,30h
mov temp[si],ah
inc si
mov ah,00h
cmp al,00h
jne Rediv
mov ah,02h
Nxt:dec si
mov dl,temp[si]
INT 21H
cmp si,00h
jne Nxt
ret
display endp
main proc
mov ax,@data
mov ds,ax
mov ah,09h
lea dx,request
int 21h
mov ah,0ah
lea dx,maxchar
int 21h
mov ch,00h
mov cl,actchar
mov di,00
start:cmp arr[di],'a'
jb upp
cmp arr[di],'z'
jbe sma
inc count[3]
jmp skip
sma: inc count[1]
jmp skip
upp: cmp arr[di],'A'
jb dig
cmp arr[di],'Z'
jbe upp1
inc count[3]
jmp skip
upp1: inc count[0]
jmp skip
dig: cmp arr[di],'0'
jb oth
cmp arr[di],'9'
jbe dig1
oth: inc count[3]
jmp skip
dig1: inc count[2]
skip: inc di
loop start
mov arr[di],'$'
mov ax,0600h
mov bh,07h
mov cx,0000h
mov dx,184Fh
int 10h
mov ah,02h
mov bh,00h
mov dx,00h
int 10h
mov ah,09h
lea dx,enter
int 21h
lea dx,arr
int 21h
lea dx,upper
int 21h
mov di,00
call display
mov ah,09h
lea dx,lower
int 21h
mov di,01
call display
mov ah,09h
lea dx,digits
int 21h
mov di,02
call display
mov ah,09h
lea dx,others
int 21h
mov di,03
call display
mov ax,4c00h
int 21h
main endp
end main