Two’s complement (4 points)
(4 pts) Write a program in assembly language to add the two numbers (-102 and -87). Inputs should be in decimal format. Store the result as hexadecimal numbers at address $6000. Print out the result in command output window in decimal format. (Hint: use the trap function task #3). If an e
or (overflow) happens, you should also print out the e
or (overflow) message as well.
You are not allowed to hardcode the two input numbers!
You should design your program to accept any two numbers as inputs!
You may ignore sanity check on corner cases, but assume user inputs are always in an expected format.
You may need to design your program to convert ASCII characters into integer numbers! Think about how to convert string "-102" into integer -102 in JAVA or C++!
Copy and paste the screen shot of the output(command) window into your submission file. Do not submit an individual file for the image!
Copy and paste the screen shot of your memory system at address $6000 into your submission file. Do not submit an individual file for the image!
Submit the source file (.X68) and the listing file(.L68) individually. Do not attach the code into your submission file! For simplicity, name your source file as HW2.X68 and your listing file as HW2.L68.