-
Notifications
You must be signed in to change notification settings - Fork 15
/
count_vowels.asm
55 lines (48 loc) · 1000 Bytes
/
count_vowels.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
;8086 PROGRAM: COUNT NUMBER OF VOWELS IN GIVEN LINE OF A TEXT/SENTENCE
.MODEL SMALL
.STACK 100H
.DATA
STRING DB 10,13,"The quick brown fox jumped over lazy sleeping dog$"
VOWEL DB ?
MSG1 DB 10,13,"Number of vowels are: $"
.CODE
MAIN PROC
MOV AX, @DATA
MOV DS, AX
MOV SI, OFFSET STRING
MOV BL, 00
BACK: MOV AL, [SI]
CMP AL,'$'
JZ FINAL
CMP AL,'A'
JZ COUNT
CMP AL,'E'
JZ COUNT
CMP AL,'I'
JZ COUNT
CMP AL,'O'
JZ COUNT
CMP AL,'U'
JZ COUNT
CMP AL,'a'
JZ COUNT
CMP AL,'e'
JZ COUNT
CMP AL,'i'
JZ COUNT
CMP AL,'o'
JZ COUNT
CMP AL,'u'
JZ COUNT
INC SI
JMP BACK
COUNT: INC BL
INC SI
JMP BACK
FINAL: MOV AH,2H
MOV DL,BL
INT 21H ;print number of vowels
MOV AH, 4CH
INT 21H
MAIN ENDP
END