CS201 Lab: Control Flow Structure

Objective of this lab:

	To investigate the Control Flow Structure and implement them in PCSpim. 
	You will learn how to use assembly language to implement an "if statement" 
	and a "loop".


	Read lab lecture notes.

Lab Assignment

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

  1. Prompt the user to enter a letter indicating Celsius or Fahrenheit
  2. Prompt the user to enter an integer indicating the temperature matching the letter just entered.
  3. Convert the temperature to its counter part.
  4. Here are the two formulas for your reference.
    	F = (9 * C / 5) + 32
    	C = 5 * (F - 32) / 9
  6. Print out the converted values with appropriate message.

  7. Testing wrong letters: G and h
    Testing values for C or c: 100, 0, 50
    Testing values for F or f: 212, 0, 50

You will hand in the following:

  1. The source code in the file convert.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 results

Copyright: Department of Computer Science, University of Regina.