Sunday, August 14

Separating Vowels And Consonants In A String Input Using Assembly Programming Language



.model small
.code
org 100h
jmp process
parlist label byte
maxlen db 30
actlen db ?
will db 30 dup(' ')
intro db 'Enter Word:','$'
con db 30 dup(' ')
vow db 30 dup(' ')
conlabel db 'Consonants:  ','$'
vowlabel db 'Vowels:      ','$'
input:
mov ah,0ah
lea dx,parlist
int  21h
cmp actlen,00h
je term
ret
term:
int 20h
printing:
mov ah,09h
int 21h
ret
clr_scr:
mov ax,0600h
mov bh,07h
mov cx,0000h
mov dx,184fh
int 10h
ret
set_cur:
mov ah,02h
mov bh,00h
int 10h
ret
process proc near
call clr_scr
mov dx,0000h
call set_cur
lea dx,intro
call printing
mov dx,0305h
call set_cur
call input
mov cl,actlen
mov ch,00
mov bx,0000
mov si,00
mov di,00
call processing
mov dx,0505h
call set_cur
lea dx,vowlabel
call printing
mov vow[si],'$'
lea dx,vow
call printing
mov dx,0605h
call set_cur
lea dx,conlabel
call printing
mov con[di],'$'
lea dx,con
call printing
jmp term
process endp
processing:
mov dl,will[bx]
cmp dl,'a'
je vowel
cmp dl,'e'
je vowel
cmp dl,'i'
je vowel
cmp dl,'o'
je vowel
cmp dl,'u'
je vowel
mov con[di],dl
inc di
bawo:
add bx,01h
cmp bx,cx
jne processing
ret
vowel:
mov vow[si],dl
inc si
jmp bawo

end process



/*This how the program is working*/


No comments:

Post a Comment