Intermediate

Count Vowels

Count the number of vowels in an uppercase string.

Write a program to count the number of vowels (A, E, I, O, U) in a null-terminated string stored at x5000. Store the count in memory location x6000. Assume all letters are uppercase.

Requirements:
• Count only the characters A, E, I, O, U

• The string at x5000 is null-terminated and all uppercase

• Store the vowel count at x6000

ASCII values:

LetterHexDecimal
Ax4165
Ex4569
Ix4973
Ox4F79
Ux5585

Approach: For each character, subtract each vowel's ASCII value and check if the result is zero. If (char - 'A') == 0, it's an 'A'.

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