This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: CMSC 216 Project #4 Fall 2011 Assembly Language Programming Due: November 6, 2011, 11:59 PM In this project, you will be writing assembly language programs, using the Y86 assembly language detailed in your textbook (with slight modifications). Your assignment is to take the C programs we give you and write equivalent assembly programs for each one. You should also aim to have your programs run in as few instructions as possible, so you may need to perform some optimizations to the programs either before or after translating them from C. 1 Procedure 1.1 Obtain the project files For this project, we have supplied both a tarfile with files you will be working with, and a Y86 assembler and simulator. Both the yas and yis programs discussed in lecture are available in the ~/216public/bin directory, so they should already be in your path. The tarfile contains a .submit file and four C programs ( fib.c , readprint.c , strcmp.c , and bubsort.c ) that you must translate to Y86 assembly programs. Extract the files from the tarball into your ~/216/project4 directory, using a procedure similar to the one you used for prior projects. 1.2 Create the assembly source files For each C program, you must create a Y86 assembly language program that functions in a similar manner (meaning it produces the same output as the C program if both are given identical input). Your primary goal should be to produce a working version of each program. As a secondary goal, you should also attempt to have your assembly programs execute on the simulator with as few steps as possible, as measured by the simulators output. A small portion of your grade will depend on the efficiency of your programs. Your Y86 source files should be named the same as their corresponding C source file, but with a .ys extension; for example, fib.ys is the Y86 assembly code for fib.c . 2 Specifications The four C programs you will translate are: (a) fib.c , a program that prints out the n th Fibonacci number (b) readprint , a program that reads in a line, and then prints it back out (c) strcmp.c , a program that reads in a line, parses it into two strings, and prints out -1, 0, or 1, depending on the result of a string comparison (d) bubsort.c , a program that reads in a line, parses it into an arbitrary number of strings, and prints them back out in sorted order. All your programs are expected to terminate via a halt instruction; abnormal termination should never occur (except in the case of an I/O error, which you are not required to handle). Also note that each program prints a newline at the end of execution; this is to guarantee that the output is distinguishable from the simulators normal output. As such, it is imperative that you do not leave it out....
View Full Document
- Spring '11