Lab #1 Familiarity with QtSpim and Introduction to Writing Assembly Code


Part 0 – Pre-lab – due at start of class on Friday January 17, 2014

a.) Read this entire lab through carefully.

b.) Read “PCSPIM Overview” from the URL above.

c.) Create and turn-in: Use a drawing tool or Microsoft Word etc. to construct pseudocode OR a flow chart for the “Program objective” for parts 1-2 described below.  This can be at a high-level – you shouldn’t need more than 10-20 lines of pseudocode.  Print two copies – one to turn in and one to use in lab.


Program objective (for Parts 1-2): Write a program that first prints your name and lab identification in a “welcome message” to the console, followed by a newline. The program then prompts the user for a number, adds 5 to the original number, adds the number to itself, and multiplies the original number by 8. Your program will output each answer individually, with text preceding the answer, such as “x+5 is”, “8*x is”, etc. Each line of output must appear on a separate line.


To perform multiplication: this can be done in a single instruction that you should have seen while reading the textbook, but there are several ways to accomplish this.


Part 1 – Getting started with SPIM (do this in lab)

Go to the URL above, and follow the instructions in the “PCSpim-HowTo: Installing and Starting SPIM” document. Look carefully at and step through (using F10) the sample program (this is a longer program that reads two numbers as input, not the same program demonstrated in class).


Part 2 – simple program

Write a .asm file that implements the program above. 




Part 3 – iterative program

(suggestion – save a backup copy before you start this)

At the beginning of your program, ask the user how many times he would like to repeat the program (call this ‘N’ times).  Then, N times, ask for an x and do the calculations and output.  However, you should only print the welcome and farewell message once.  Turn in only one copy of your program (the improved, Part 3, version).



Due on Friday January 24, 2014 – start of class

·       Electronic: submit your .asm file – go to Blackboard -> IC220 -> Assignments -> Lab 1 Qtspim.   Submit just your .asm file.

·       Hard-copy:  turn these in, stapled in the following order:


Your hardcopy and the file submitted with Blackboard must identical.  In addition, your file must be commented.


Unless you are very quick, you’ll start this lab during classtime and finish it for homework.  If you have trouble with QtSpim on your personal machine, it is also available in the Windows labs in Michelson.