CS611
Programming Assignment 2
Fall 1998


Write two Alpha assembler functions that convert back and forth between Ascii representations of decimal integer numbers and (internal Alpha 64-bit) integer values.

The function "atoi" should take two arguments. The first argument is the string that contains the Ascii of the number to be converted. The second argument is a pointer to where in the memory the converted integer value should be placed.

The function should return a status value: 1 for success and 0 for failure.

This function should error check its arguments and return 0 for any error. The first argument must be non-null, must not be the empty string, and should contain only legal decimal digits or the minus sign, which if present must appear only once and should be first in the string. The first argument when converted should fit in 64 bits (i.e. consider overflow to be an error). The second argument should be non-null.

The function "itoa" should take two arguments: the first argument is the integer to be converted and the second argument is a pointer to an area in memory where the output string can be placed.

The function should also return a status value: 1 for success and 0 for failure.

This function also should error check its arguments and return 0 for any error. Can any errors be detected in the first argument? The second argument should be non-null.

These functions may not call any other functions. Each function must do all the work itself.

The directory ~cs611/public/prog2 contains stubs for the functions in convert.s. It also contains a main function (written in C) and a Makefile to illustrate how you can build and test your program.

The two functions will be worth equal credit: each is worth half of the points for the assignment.

Your program will be graded primarily by testing it for correct functionality. However, you may lose points if your program is not properly structured or adequately documented. Remember that with an assembler program documentation is even more important than with C programs.

No test files will be publicly available for this assignment! Do your own testing!

Your programs should be submitted for grading from alberti (or hopper or christa). To turn in this assignment, type:
~cs611/bin/submit prog2 convert.s

Do not turn in any non-Ascii files (i.e. no object files, no executable files, etc.).

Submissions can be checked by typing:
~cs611/bin/scheck prog2

To receive full credit for the assignment, you must turn in your files prior to 8am on Monday October 5. Late submissions will be accepted at the penalty of 5% per day up to one week late.

Remember: as always you are expected to do your own work on this assignment.


Last modified on August 26, 1998.

Comments and questions should be directed to pjh@cs.unh.edu