Return To CS 301 Lab Home

Colour Theme   Font Size Options
 
   
   
   

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:


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:



Copyright: Department of Computer Science, University of Regina.