The objectives of the programming assignment are 1) to gain experience writing larger assembly language programs, and 2) to gain familiarity with various branching operations.
String constants in UNIX and in C/C++ are allowed to contain control characters and other hard-to-type characters. The most familiar of these is '\n' for a newline or linefeed character (ASCII code 10). The '\n' is called an escape sequence. For this project, we will consider the following escape sequences:
In addition, strings can have octal escape sequences. An octal escape sequence is a '\' followed by one, two or three octal digits. For example, '\a' is equivalent to '\7' and '\\' is equivalent to '\134'. Note that in this scheme, the null character can be represented as '\0'. The octal escape sequence ends at the third octal digit, before the end of the string, or before the first non-octal digit, whichever comes first. For example "abc\439xyz" is equivalent to "abc#9xyz" because the ASCII code for '#' is 438 and 9 is not an octal digit.
For this project, you will write a program in assembly language which takes a string input by the user, convert the escape sequences in the string as described above and print out the converted string. In addition, your program should be robust enough to handle user input that might include malformed escape sequences. Examples of malformed escape sequences include: a '\' followed by an invalid character, a '\' as the last character of the string and a '\' followed an octal number that exceeds 25510.
All the invalid escape sequences should be reported to the user (i.e.,
your program should not just quit after detecting the first invalid escape
sequence). When the user input has malformed escape sequences, your
program should still convert and print out the rest of the string (which
might contain some valid escape sequences). In this case, a '\'
should be printed at the location of malformed escape sequence. For
example, if the user types in "abc \A def \43 ghi \411" your
program should have output:
Before you submit your program, record some sample runs of your program using the UNIX script command. You should select sample runs that demonstrate the features supported by your program. Picking good test cases is your responsibility.
Use the UNIX 'submit' command on the GL system to turn in your project. You should submit two files: 1) your assembly language program and 2) the typescript file of your sample runs. The class name for submit is 'cs313' and the project name is 'proj1'.
Recall that the project policy states that programming projects must be the result of individual effort. You are not allowed to work together. Also, your projects will be graded on five criteria: correctness, design, style, documentation and efficiency. So, it is not sufficient to turn in programs that assemble and run. Assembly language programming can be a messy affair --- neatness counts.