I can't seem to find a way to add a vowel counter to my program. The program must use Irvine32.inc in order to be valid.
INCLUDE Irvine32.inc
ExitProcess PROTO, dwExitCode:DWORD
.data
msg1 BYTE "Enter any string of your choice: ",0
msg2 BYTE "The number of words in the input string is: ",0
msg3 BYTE "The output string is: ",0
string BYTE 50 dup(?)
vowelc BYTE ?
.CODE
main PROC
mov edx,offset msg1 ;;PROMPT FOR STRING
call writestring
mov ecx,50
mov edx,offset string ;;LOAD THE ADDRESS OF THE STRING
call readstring ;;READ STRING
call crlf ;;NEWLINE
lea esi,string ;;STARTING ADDRESS OF THE STRING INTO ESI
repeet:
mov al,[esi] ;;LOAD ONE CHARACTER INTO AL
cmp al,0 ;;CHECK AL==0?
je eos ;;IF AL==0, GOTO EOS BECAUSE IT SAYS END OF STRING
cmp al,20h ;;CHECK AL==20?
jne ahead ;;IF AL IS NOT SPACE GOTO AHEAD
jmp nochange ;;JUMP TO NOCHANGE
ahead:
cmp al,61h ;;CHECK AL==61? IF LOWER LIMIT OF LOWER CASE
jl checklimit ;;IF THE CHAR IS < 61, IT CAN BE A CAPITAL LETTER OR SOME OTHER CHAR. HENCE GOTO CHECKLIMIT
cmp al,7ah ;;CHECK AL==7A?
jg nochange ;;IF ANY OTHER CHAR, MAKE NO CHANGE
sub al,20h ;;CONVERT LOWERCASE TO UPPERCASE
mov [esi],al ;;SAVE TO STRING
jmp nochange ;;GOTO NOCHNAGE
checklimit:
cmp al,5ah ;;CHECK AL==5A?
jg nochange ;;IF CHAR > Z, MAKE NO CHANGE
cmp al,41h ;;CHECK AL==41?
jl nochange ;;IF CHAR < A, MAKE NO CHANGE
add al,20h ;;IF CHAR IS FROM A - Z,CONVERT IT TO LOWERCASE
mov [esi],al ;;STORE IT TO STRING
nochange:
inc esi ;;INCREMENT ESI TO GET NEXT CHAR
jmp repeet ;;REPEAT TILL END OF THE STRING
eos:
mov edi, OFFSET string
mov al,'A'
mov ecx, LENGTHOF string
mov edx,offset msg3 ;;DISPLAY PROMPT3 MESSAGE
call writestring
mov edx,offset string ;;DISPLAY CHANGED STRING
call writestring
call crlf
INVOKE ExitProcess, 0 ;;EXIT
main ENDP
END MAIN
Somehow I have to find a way to add a vowel counter into this program without messing anything up but I don't know how.
I tried looking for options in my book but I couldn't find any related code.
I did also try to look for info on other sites but nobody seems to be able to help me.