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".

Preparation


	Read lab lecture notes.

Lab Assignment

Please note:
To make it easier for marking, you are required to submit one .pdf file and all the .s files.
The .pdf file will contain all the required components for the lab assignment.
This will apply to Lab #7 to Lab #10.

Program Loop:

Write a SPIM assembly language program equationLoop.s based on the example program math1.s in the previous lab notes.
The program will do the following three things for 5 times:
  1. Prompt the user to enter a value for X each time. (The recommended testing values for X are 7, 5, 9, 6, and 2.)
  2. Calculate the corresponding result of this expression A*X^2+B*X+C.
  3. Print out the calculted result with appropriate message.

You will hand in the following:

  1. The source code in the file equationLoop.s.
  2. The screenshot to show the screen right after you loaded the .s file.
  3. The screenshot of the console displaying the results for the corresponding input values.


Copyright: Department of Computer Science, University of Regina.