Well…i posted this code na although it is not yet perfect.
If number of vowels/consonants is 10 or more, it will display it’s ascii equivalent not the number. I shall post the update soon or perhaps you want to help me with it…hehe:)
mov ah, 0ah
lea dx, parameter
int 21h
mov ah, 02h
mov dl, 0ah
int 21h
mov dl, 0dh
int 21h
;—————–initializtions—————–
xor bx,bx ; count vowels
xor dl, dl ; count consonants
lea si, input ; load string
xor cx, cx
mov cl, [actlen] ; loop counter
;———————loop———————–
; idea: filter out lot letters
; check if vowels. if yes, update vowel counter
; if no, update consonant counter
;————————————————
voc:
mov al, [si]
cmp al, 122 ; filter not letters
ja skip
cmp al, 96
ja check
cmp al, 90
ja skip
cmp al, 65
jb skip
check:
cmp al, ‘A’
je vowel
cmp al, ‘a’
je vowel
cmp al, ‘E’
je vowel
cmp al, ‘e’
je vowel
cmp al, ‘I’
je vowel
cmp al, ‘i’
je vowel
cmp al, ‘O’
je vowel
cmp al, ‘o’
je vowel
cmp al, ‘U’
je vowel
cmp al, ‘u’
je vowel
jne cons
vowel:
inc bl
jmp skip
cons:
inc dl
jmp skip
skip:
inc si
loop voc
;—————-end of loop————————-
;so that bl becomes character
add bl, 48
add dl, 48
;———————–results———————-
; first is the consonant count
; followed by vowel count
;—————————————————-
mov ah, 02h
mov dl, dl
int 21h
mov dl,0ah
int 21h
mov dl,0dh
int 21h
mov dl, bl
int 21h
int 20h
parameter label byte
maxlen db 20
actlen db ?
input db 20 dup (’$')
ten vowels please!
Posted by jinky at September 15, 2009, 4:09 pmASk lAng Poh,hOW to cREAte a PRogRAm tHAT wOUld fOLLow tHE menU:
1. ascii table
2. consonants
3. vowels
4. exit
All comments are moderated. Your comments will not appear here unless approved by the blog owner. Thank you.
hi pheng! i wasn't able to figure this one out! hihihi the increments get srewy inside the loop im doing for some reason _unknown_. got stuck up and frustrated last saturday actually. hahaha.. poor me. anyway, grats on nailing the program!
Posted by niel at August 7, 2006, 5:11 am