LAB 3 Due February 2, 9PM Multi-base adding machine This is an ungraded programming assignment -- see syllabus for information on how it will be counted. This project builds on the numeric I/O of the previous assignment to make a multi-base adding machine. Rather than ask for a base and a number in a loop, you will read in commands and numbers where, adding-machine like, the commands are unprompted (though is an invalid command or number is put in, you should give the user some help). The adding machine will have 6 functions: + Add a number to the current sum - Subtract a number from the current sum = Print current sum z Zero the current sum # Prompt user for a base change (always base 10, without commas) x Exit All numbers entered are unsigned (since we can add and subtract) Results are signed: print a + or - with each answer, since we can't use the traditional red and black of adding machines. The system will work with bases from 2..60 (with an initial base of 10) For input and output, use the comma notation of lab 2. For example: <> +1,0 #75 <> 2 <> +1,0 = <<+1,1,0,0>> #16 <> = <<+12>> z #60 <> +10,12 = <<+10,12>> #10 <> = <<+6,1,2>> +C <> +1,2 = <<6,2,4>> -6,3,0 = <<-6>> x <> Notes: 1. Use the input routines from the previous assignment. You should be able to use your multi-digit reading routine for entering bases (numbers in base 10 between 2 and 60). 2. Error messages are important: what errors can come up? A few are illustrated above. 6. The main program will call the routines depending on the control characters. (+, -, =, #, z, x). It will read a single character which will indicate the command to be performed (or an informative error message if it is not one of the 6 characters above), and then move into a 'case' statement structure (ie, if-elseif-elseif-...) to process each command. The + and - commands will read a number in the current base and process it. The = command will print out the sum in the current base. The # command will read a number in base 10, print out a message about the new base (in base 10), and set the current base. The z command has no input or output, but resets the accumulator. The x will print a closing prompt and end the program. Apart from the case of x, you will keep looping to read in a new command. Optional: a. Include additional operators b. For bases <= 16, do I/O without the commas c. Check for overflow d. Nice error messages. Handin: calc.spim: The well documented code README: Name and email address, and answers to: a. If you did not implement to two different I/O formats, write a few sentences about how you would. b. What ASM statements would you use to check for overflow in arithmetic operations? c. What ASM statements would you use to check for overflow in data input (ie, numbers that are too large). Grading: 10: README with questions answered, program 8: README without questions answered but with code comments 7: No readme 5: No calc.spim but great readme 0: No readme and no calc.spim Checkoff: -1 Late Checkoff (Wednesday; no latter) -1 Not quite fully functional -2 Not entirely functional -3 Almost entirely not functional -4 No checkoff