COSC 065 Hardware Systems

Fall 2007

Homework Assignment #9

Basic x86 Assembly Language
Due: Wednesday, Nov 28, 2:00PM CST
Submit: E-mail electronic copy to professor, with a subject header "COSC 065 HW#9".
Work may be completed in pairs. Each team should submit only once. Be certain to put both team member names on work submitted. It would be courteous to carbon-copy your partner when e-mailing the final submission.

Background

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

Intel x86 assignments are to be compiled and run natively on our Linux workstations in the systems lab. You will not require the MIPS Playground or the mipcon tool for this assignment. Instead, compose your program in an empty file, perhaps starting with the Intel x86 demo as a template.

Your work must be compiled on a machine with the proper tools, such as the dual-head Linux boxen in the Systems Lab (CU 310). Consult the professor for advice on connecting remotely if the lab is full or you must work from elsewhere. Intel x86 machines can be identified by running the command uname -p; look for machines that identify themselves as i386, i586, or i686. Your x86 programms will not compile or run on the PowerPC and MIPS hardware we have in the lab, and I do not recommend compiling with the 64-bit AMD machines for these assignments. The current list of x86 boxes in the systems lab includes: Argolis, Calufrax, Gallifrey, Kastria, Skaro, Telos, Traken, and Zanak. All of these machines are remotely accessible by secure shell. (E.g. ssh argolis.mscs.mu.edu, etc.)

In order to assemble your program, use the command "gcc". In order to run your program, use the command "./a.out". If you do not want your compiled program to be called "./a.out", you may use the "-o" option to gcc to alter the outputed program.

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.

Example:
? 3
? 4
? 5
? 0
12
4
5
3

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.

Example:
? 2
? 30
1073741824

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.

Example:
? 100
212

You may assume that overflow and underflow do NOT occur.


Back
[Revised 2007 Nov 25 20:01 DWB]