YOU DO NOT NEED TO DOWNLOAD PCSPIM IN THE 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, it is suggested that you use instructions that we have already learned in class (a single one will suffice), though if you wish you can figure out how the multiply instruction works and use that.
Part 1 – Getting started with SPIM (do this in lab)
Follow the instructions in the PCSpim “How To” document (from URL above). Look carefully at the sample program.
Part 2 – simple program
Write a .asm file that implements the program above. You may wish to base your solution on the sample program.
Steps to the Solution:
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 version).
Due on Thursday January 29, 2009 – start of class
· Lab #1 Cover sheet (McDowell sections)
· Screenshot of your code executing for N=3, with x = 12, then 17, then 20
· Hardcopy of .asm file, stapled to your cover sheet
· Digital copy of .asm file – copy this into your X: drive inside a folder named “IC220Lab1”. Name your file as follows: Lab1-section-lastname.asm. Example: Lab1-2001-smith.asm
Your hardcopy and the file in your X drive 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. To use PCSpim you can either come to the lab in Michelson or install PCSpim on your own PC, see the instructions at the link above.