csci 10 :: book learning challenge 4 (due mon, feb 22)
Submitting your work:

Complete this exercise on your own.

Fill in all of the "Answer" boxes, then print the answer grid that you see after you press "Prepare for printing".

Staple all pages together and submit to the instructor on the date listed above.

Questions:

Read AoA V1 2.7, V1 2.8, V3 10.2 and answer the following:

Your name:
  1. In section 2.7 of your text, the author states that "Registers are a middleman in nearly every calculation." Briefly explain what he means in the context of adding two variables together and storing the sum in a third variable.
    Answer:
  2. Write the assembly add instruction that would map to the following high level language statement.
    destination = destination + source;
    Answer:
  3. Write the assembly sub instruction that would map to the following high level language statement.
    destination = destination - source;
    Answer:
  4. Do the add and sub instructions support memory-to-memory operations? Briefly explain the implications of your answer (HINT: refer to your answer in #1 above).
    Answer:
  5. Translate the following high level expression into assembly code. You do not need to declare variables -- assume x has been properly declared as an uns8 variable.
    x = x + 10;
    Answer:
  6. Translate the following high level expression into assembly code. You do not need to declare variables -- assume x and y have both been properly declared as uns16 variables.
    x = x + y;
    Answer:
  7. Translate the following high level expression into assembly code. You do not need to declare variables -- assume x has been properly declared as an int16 variable.
    x = x + 999;
    Answer:
  8. Translate the following high level expression into assembly code. You do not need to declare variables -- assume x and y have both been properly declared as int32 variables.
    x = x - y;
    Answer:
  9. Translate the following high level expression into assembly code. You do not need to declare variables -- assume x and y have both been properly declared as int16 variables.
    x = x - y;
    Answer:
  10. Translate the following high level expression into assembly code. You do not need to declare variables -- assume x has been properly declared as an uns32 variable.
    x = x * 5;
    Answer:
  11. Translate the following high level expression into assembly code. You do not need to declare variables -- assume x and y have both been properly declared as uns16 variables.
    x = x * y;
    Answer:
  12. Translate the following high level expression into assembly code. You do not need to declare variables -- assume x has been properly declared as an int8 variable.
    x = x * 5;
    Answer:
  13. Translate the following high level expression into assembly code. You do not need to declare variables -- assume x and y have both been properly declared as int16 variables.
    x = x * y;
    Answer:
  14. Translate the following high level expression into assembly code. You do not need to declare variables -- assume x, y, and z have both been properly declared as uns16 variables.
    z = (x + 10) * (y + 5);
    Answer:
  15. Translate the following high level expression into assembly code. You do not need to declare variables -- assume x, y, and z have both been properly declared as int32 variables.
    z = (x * 2) - (y * 3);
    Answer:

Total points for this book learning challenge:

150 points