Overview Write a program that adds 2 unsigned, 16-bit integers and prints the sum as a numeric text string. Requirements The program does the following 4 steps: 1. Read the 2 input, one at a time. a. Prompt the user for one unsigned, 16 bit integer at a time. b. Check that each input number is within the range of an unsigned 16-bit integer. Otherwise print one of two error messages: "number is too large" or "number is negative" then keep re-prompting until you get a valid number. c. If the user enters 1 valid number and 1 invalid number, only print the error message and re-prompt for the invalid number. Challenge: can you use one loop for step 1 , instead of using 1 loop for the first number, and an almost duplicate loop for the second number? After step 1, starting at this point, you must use 16-bit registers for the 2 use input numbers. ( 2 pts of the lab is for using 16 bit registers for the 2 numbers.) 2. Add the 2 numbers. a. Add the 2 numbers and then check whether the sum is valid. Remember that you're only allowed to use 16-bit registers. How would you check for invalid data when you can't use 32-bit registers for adding? b. If the sum is not valid, print an error message and go to step 4 . 3. If the result is valid: a. Convert the sum into a string of characters: . You'll need to define an array in the .data section that's large enough to store the string of characters. Remember that text strings should end with a null termination so that they can be printed with the IO procedures. What size should the array be? - Loop to extract each digit of the sum, convert the digit into an equivalent character, then store the character into the appropriate location in the array. See note about conversion below. b. Call writeString and print the text string to screen. When printing the result, print a text explanation first, such as "Sum = ", then print the resulting string. See sample output. Note about conversion from a number, such as 217 , to an equivalent text string with characters ' 2 ' ' 1 ' ' 7 ' - Look up the ASCII table to see what the ascii number is for the characters ' 0 ', ' 1 ', ' 2 ', ... ' ' '. If you have a number 2, how would you change it so that you get the ascii number for the character ' 2 '? - To store the character in the correct location in the array, remember that indexing an array in assembly is very similar to Assuming you have an array Arr with 4 elements: 10, 20, 30, 40 4. Loop back to start again if user says yes After printing either the resulting string or the "invalid result" error message: a. Ask the user whether to continue again b. Accept '
y
' or '
Y
' as the answer to loop back to step 1 . c. If the user enters anything else, end the program. Additional requirements - Document your program to get full credit. Don't forget your name and lab description. Explain your loop and if else implementation. - Don't use any memory variables for numbers. Store all numeric data in registers. - Use 16-bit registers only, unless you're calling an Irvine IO procedure. - You must use writeString to print the result. Using writelnt means an automatic 5 point deduction. - Don't use bit-wise instructions (shift, and, or...) for this lab. - Don't use the decision directives of MASM. Implement loops and if statements with assembly instructions. - Keep your logic flow as simple as you can. Use "fall through" logic as shown in class notes or the book. Testing Test your result adequately: with valid and invalid input, with valid and invalid sum (result of step 2).