Sample Homework Assignment #4
This is a sample assignment, which is exactly like all the practice problems posted in this module. Just in case you wanted more practice, here you go. Some of the numbers in there care large-ish, and a calculator may be useful. In exams/quizzes numbers will be small and a calculator is not needed.
Solutions
Solutions are available as a plain ASCII file.
Exercise #1: Overflow [50 pts]
For each of the following hex operations:
- 2-byte quantities: 9210 + C123
- 2-byte quantities: 2100 + 7033
- 1-byte quantities: B5 + 25
- 1-byte quantities: E1 + D4
- 1-byte quantities: F2 + 8F
Answer these 3 questions:
- say whether the carry bit is set or not set
- say whether the overflow bit is set or not set and explain your reasoning.
- say what would be printed by print_int if the result of the addition were
sign-extended into the EAX register (Remember that this macro prints
signed numbers in decimal representation).