Write an assembly language program to count number of vowels
Write an assembly language program to count number of vowels in any given string.
Solution
Below is the program to count vowel from a string input from user countvowels: mov di,VOWL mov si,STR mov bp,di mov cx,END mov bx,STR sub cx,bx ;this is stringlength for loop dec cx ;adjust cx looping push cx ;its saved for repeating sub si,1 ;tweak si nextletter: inc si mov al,[si] vowelrotate: cmp al,[di] jz addone loop nextletter inc di ;vowel pointer rotate at end of string mov si,STR-1 ;return to start of string pop cx ;loop count for string push cx mov ah,\"x\" ;check for end of vowels cmp [di],ah jz finished jmp nextletter addone: ;vowel count inc dx jmp nextletter finished: ## VOWL db \"aeioux\" STR db \"input string from keyboard\" END