5.23 · exercise

count the vowels

A sentence lives in .data (a famous one: it uses every letter of the alphabet). Count its vowels.

Strings are just bytes ending in a zero. Load one byte at a time with ldrb, stop at the terminator, and bump the count for every a, e, i, o, or u. Character literals like 'a' work directly in cmp, and the post-indexed form ldrb wX, [ptr], 1 loads and advances the pointer in one instruction.

what is checked

  • the vowel count is printed on its own line
  • the program exits cleanly
  • the walk is byte by byte (ldrb present, count not written in)

Specification

args
stdoutprints the expected output
exitexits with the expected code
sourceuses ldrb
sourcecomputes the result (does not hardcode it)

Checked by running your program against expected behavior, never by matching a stored solution.

loading editor...
Open in playground