## Objective of this lab:

```
To explore ARM subroutine calls and implement them in Keil uVision5

```

```

```

## Lab Assignment

### Assignment#1:

Write an ARM assembly language program CountVowelsTwo.s to count how many vowels and how many non-vowels are in the following string.
```	"ARM assembly language is important to learn!",0
```
You are required to implement this by using a subroutine to check if a letter is vowel or not, and count the vowels and non-vowels in the calling function.

Recommendations for writing the program:

• Put the string in the memory by using DCB.
• Use R0 to hold the address of a character in the string.
• Use R2 to be the counter for vowels.
• Use R3 to be the counter for non-vowels.
• Build the program, debug untill there is no error.
• Make a screenshot to show that the build is successful with no errors.
• Run the program step by step and see how values are changing in the registers.
OR just run the program and see the final results in the register R2 and R3.
• Make a screenshot to capture the results in your designated registers.

## You will hand in the following:

1. The source code in the file CountVowelsTwo.s
2. The print out of the screen shot (print screen) to show the program has been successfully built
3. The print out of the screen shot showing the number of vowels in R2 and non-vowels in R3.

### Assignment#2:

Write an ARM assembly language program that will have a user defined function/procedure factorial to calculate the factorial for a given number.
```	For example:
The factorial of 5 is 5! = 5 x 4 x 3 x 2 x 1
The factorial of 0 is defined as 0! = 1
In general, n! = n x (n-1)!, where n is a positive integer.
If we write f(n) = n!, then f(n) = n f(n-1).
It is a recursive function.

You may try to implenment it by using stack.
When you test it, you can use reletively smaller numbers such as 3, 4, 5, or 6.

For marking purpose, put the input number in the R1 and
put your final result in the register R0 or
indicate it specificly in your hand-in assignment.
```

## You will hand in the following:

1. The source code in the file Factorial.s
2. The print out of the screen shot (print screen) to show the program has been successfully built
3. The print out of the screen shot showing the result in R0

Copyright: Department of Computer Science, University of Regina.