## Objective of this lab:

```
In this lab assignment, you are going to practice
implementing procedure calls in SPIM.

```

```

```

## Lab Assignment

### Program#1:

In the Control Structure lab, you were assigned the following assignment:

```
Write a SPIM assembly language program convert.s.
The program will do the following:

Prompt the user to enter a letter indicating Celsius or Fahrenheit.

C or c indicates that temperature entered is in Celsius.
F or f indicates that temperature entered is in Fahrenheit.
If the letter entered is not C,c,F,or f, print out
the error message, "Wrong Letter!"

Prompt the user to enter an integer indicating the temperature
matching the letter just entered.

Convert the temperature to its counter part.
Here are the two formulas for your reference:

F = (9 * C / 5) + 32

C = 5 * (F - 32) / 9

Print out the converted value with an appropriate message.

```

For this lab, you will modify the previous program convert.s to convertP.s
so that it will implement the same thing by using procedure calls:

1. You will write a procedure/function named "formulaCtoF" to convert a temperature from Celsius to Fahrenheit.
2. You will write a procedure/function named "formulaFtoC" to convert a temperature from Fahrenheit to Celsius.
3. The integer temperature entered will be passed into an appropriate function.
4. Two different functions can be called when needed.
5. The converted temperature will be returned to the calling function.

## You will hand in the following:

1. The source code in the file convertP.s
2. The print out of the screen shot (print screen) to show the program has been successfully loaded.
3. The print out of the screen shot of the console displaying the testing
results: C or c with 100, 0, 50 and F or f with 100, 0, 212. G and h will be used to test the wrong letter case.

### Program:

Write a SPIM assembly language program num-vowel.s to find out the number of vowels and the number of non-vowels in a given string and use procedure call to check if a letter is vowel or not. (Hint: The example program Is-vowel.s in the lab notes is very helpful.)
The program will do the following:
1. Prompt the user to enter a string.
2. Read letters in the string from the beginning to the end.
3. The program will call the procedure vowelp to check if a character entered in the string is a vowel or not.
4. Count how many vowels and how many other characters are in the string.
5. Print out the calculated results with appropriate message.
6. Hint: A loop is needed.

## You will hand in the following:

1. The source code in the file num-vowel.s
2. The print out of the screen shot (print screen) to show the program has been successfully loaded.
3. The print out of the screen shot of the console displaying the testing result
for "I am going to run this program with the real hardware next week."