"Don't tell me how hard you work. Tell me how you get done."
- James J. Ling

Count Vowels & Consonants

August 6, 2006

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 (’$')

Posted by phengpheng at 5:21 pm | permalink

Previous Comments

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

ten vowels please!

Posted by jinky at September 15, 2009, 4:09 pm

ASk lAng Poh,hOW to cREAte a PRogRAm tHAT wOUld fOLLow tHE menU:

1. ascii table
2. consonants
3. vowels
4. exit

Posted by Jun Mark at September 17, 2009, 10:53 am

All comments are moderated. Your comments will not appear here unless approved by the blog owner. Thank you.

Add a comment








     

August 2006
M T W T F S S
« Jul   Sep »
 123456
78910111213
14151617181920
21222324252627
28293031  

About Me

A Computer Science graduate who is a fanatic in assembly, java, and j2me programming. Developed BlueVoice system (Direct Voice Communication in Mobile Phones), this system allows mobile users to experience FREE VOICE CALLS

Subscribe

Technorati
Bloglines

Tagboard

phengpheng:

Haven’t managed my blog for a long time already because I’m so busy now… Sorry to cause you guyz trouble…

Jun Mark:

hoW tO creaTE a PrOGram thAT woULD oUTpuT ascii table???

Jun Mark:

pLZ anSwer mY qUEstions

cutieGurl:

how to convert binary to hexadecimal, decimal and octal?????????please. answer me??????????

mary ann:

kuya, ung binary to decimal converter nyo. mali man? ung sa mga compare mo. ung may 0,9,A,F etc… bad character lumalabaspls rep asap po. tnx

carol:

how to convert decimal to binary to octal and hexadecimal

Galwin:

been here!

galwin:

nice site. hope you could visit mine, too.

pathy:

FRIENDS FOREVER!! Miss you na!!!

ridvan:

aus, i seldom see lady programmers. hehe. keep it up. and oh yeah, i guess i saw you during the MICT Quiz Show held in cdo. :)
keep up the codes!

phengpheng:

I miss updating this blog… Sana may time and pc ako to learn new stuffs aside from my work…

support:

Congratulations, you’ve just completed the installation of this shoutbox.

pheng:

uy! you’re here again!

Jay:

Woooohhhh orange…sweat… nakakasilaw! hehe :)

jay:

tagboard flood hehe sensya… had nothing fun to do. :)

pheng:

jaaaaayyyyy….:) ketal man?:)

niel:

no spamming please :p hehehe joke lang jay.

Jay:

Uyyyyyy!!!! Grraaaaaaaiiiinnnneeee
:)
Sssshhhh, el sikret! :)
Niiiiiiiiiiiiieeeeeel
Sup dude!!!!
Paaaaaaaaaaaaaathy
Ketal!?

niel:

ei pheng! :D slick-elegant layout! love it!

yue:

phengpheng!

Leave a message ▼