For this assignment, you may work in pairs (2 people). All students (whether working in a pair or not) must individually turn in the assignment by individually running the handin program. Therefore, 2 copies of the assignment will be turned in for those working as a pair. The grader will choose to grade only one copy of a pair's work, and assign the same score to both students.
If working in a pair, the names and sections of BOTH students must appear at the top of the turned in assignment.
This MAL program is an extension and variation on Assignment 2, to incorporate more aspects of the C program implemented in Assignment 1. (The next assignment will re-implement much of the C program, in MIPS assembly language, using a fixed set of conventions for function implementation.) This program uses an array to hold multiple integers entered by the user.
In addition to reading in each hexadecimal value, the program will place the two's complement representation of that value into an array.
After the program has the valid integers in the array, it prints the values out (in decimal).
Just like in assignment 2, the user enters the newline character to identify the end of a hexadecimal value. For this assignment, if the user enters a newline as the first character of a hexadecimal value, that signals that no more hexadecimal values are to be entered. This provides a way for the user to enter fewer than 6 values.
Here are examples of program execution. User input is given in boldface to distinguish it from program output. Note that the user must enter the newline character after each integer input in this program.
Acceptable program input
Enter up to 6 hexadecimal values (newline to quit): Enter value: 0013 Enter value: -cab Enter value: Values entered in decimal: 19 -3243
Again, acceptable program input, showing that after the user enters the 6th value, the program stops prompting for values, and continues on.
Enter up to 6 hexadecimal values (newline to quit): Enter value: -b Enter value: a0 Enter value: -00000 Enter value: 780000 Enter value: 25000a Enter value: -a6 Values entered in decimal: -11 160 0 7864320 2424842 -166
The following examples illustrate what the program does with bad input.
Bad character or digit character for any of the values
Enter up to 6 hexadecimal values (newline to quit): Enter value: -b09 Enter value: 123h Bad hex value encountered. Quitting.
Again, bad character or digit character
Enter up to 6 hexadecimal values (newline to quit): Enter value: 99ab- Bad hex value encountered. Quitting.
Again, bad character within an integer (assume that there is a space or tab character after the 'e')
Enter up to 6 hexadecimal values (newline to quit): Enter value: ace Bad hex value encountered. Quitting.
Also include a comment at the top of the source code with your name and section (and your partner's name and section, if working in a pair).
See Guidelines for Programs to see an indication of point allocation used in program grading.
arrayhex.s, and place the entire program into this file. This file is what will be turned in. It must have exactly this name to make the lab-supported handin program work.
doneinstruction) in the program.
You will turn in your assembly language source code file by uploading your file to the assignment 3 Moodle site.
Make sure that your source code is in a single file
You may upload early versions of your code, but
the last one you upload is the only one we will see or score.
You do not need to mark your assignment as submitted;
we will score either the draft or the submitted file.
Once you mark your file as submitted, you may not change it or
upload another version.