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.outunless 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: |
---|