Subroutine Calls

Objective of this lab:


	To explore ARM subroutine calls and implement them in Keil uVision5 

Preparation


	Read lab lecture notes.

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:

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.