Subroutine Calls

Objective of this lab:


	To explore ARM subroutine calls and implement them in Keil uVision5 

Preparation


	Read lab lecture notes.

Lab Assignment

Program#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 character is vowel or not, and count the vowels and non-vowels in the calling function.

Recommendations for writing the program:

You will hand in the following:

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

Program#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. 

	Please implement it by using stack.
	When you test it, you can use relatively 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 specifically in your hand-in assignment.

You will hand in the following:

  1. The source code in the file Factorial.s
  2. The screenshot (print screen) to show the program has been successfully built
  3. The screenshot showing the input number in R1 and the result in R0


Copyright: Department of Computer Science, University of Regina.