COSC 065 Hardware Systems

Fall 2006

Homework Assignment #4

Basic PowerPC Assembly Language

Due: Wednesday, Oct 18, 12:00PM CDT
Work may be completed in groups of up to two students. I strongly recommend that you take the time to meet with your partner in person and work together on these projects, rather than work separately and try to integrate at the last minute.
Background:

Take time to familiarize yourself with the UNIX environment, using the tutorial here.

Always start your assignments using the template here.

Your work must be assembled and run on Morbius (morbius.mscs.mu.edu). In order to make use of the helper I/O functions getnum, printnum, and printhex, you must have a copy of cosc065.s in your directory.

Assemble your programs on Morbius using the command:

gcc cosc065.s <myfile.S>

Run your programs on Morbius using the command:

./a.out
unless you have used the "-o" option to gcc to change the name of your assembled executable.

Few rules govern the format of assembly language programs. Make an effort to keep your programs readable and well-documented; sometimes the professor gives partial credit if he can tell what you were trying to do, even if it doesn't quite make it.
Q1 - Stats

Write an assembler program that reads in integers from the user until a zero is entered. Print the total, the average (total divided by number of items, truncated to an integer), the highest integer seen, and the lowest integer seen.

The professor has provided an example program for your reference, runnable on Morbius as ~brylow/cosc065/bin/hw4-stats.

You may assume that overflow and underflow do NOT occur.
Q2 - Exponent

Write an assembler program that reads two positive integers, x and y, and prints x to the y power. Your program should continue asking for integers until it has gotten two positive numbers.

The professor has provided an example program for your reference, runnable on Morbius as ~brylow/cosc065/bin/hw4-exp.

You may assume that overflow and underflow do NOT occur.
Q3 - Celsius to Fahrenheit

Write an assembler program that reads a positive integer, and converts that integers from a temperature on the Celsius scale to a temperature on the Fahrenheit scale. You need only use integer precision for the conversion.

The professor has provided an example program for your reference, runnable on Morbius as ~brylow/cosc065/bin/hw4-ctof.

You may assume that overflow and underflow do NOT occur.
What to turn in:

  • E-mail your three assembly source files to the professor (brylow at mscs.mu.edu), with a subject header "COSC 065 HW#4".
  • Be certain to put both team member names on work submitted. It would be courteous to carbon-copy your teammate when e-mailing the final submission.
    Back