csci 10 :: book learning challenge 14 (due mon, nov 28)
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 V3 10.2, V4 2.2, V4 2.3, V4 2.4, V4 2.5, V4 2.6 and answer the following:

Your name:
  1. Briefly describe the operation of the x86 cmp instruction (HINT: your book suggests that cmp is "identical" to the sub instruction, with a crucial difference). What register contains the result of the cmp instruction after it executes?
    Answer:
  2. Convert the following high-level decision into assembly.
    if (al == 100) then

         stdout.put("A perfect score!");

    endif;

    Answer:
  3. Convert the following high-level decision into assembly.
    if (al == 42) then

         stdout.put("That is the answer.");

    else

         stdout.put("Nope.");

    endif;

    Answer:
  4. Convert the following high-level decision into assembly.
    if (al == 1) then

         stdout.put("You selected door number one.");

    elseif (al == 2) then

         stdout.put("You selected door number two.");

    elseif (al == 3) then

         stdout.put("You selected door number three. Prize inside!");

    endif;

    Answer:
  5. Convert the following high-level decision into assembly.
    if (al == 'A') then

         stdout.put("A is for Apple.");

    elseif (al == 'C') then

         stdout.put("C is for Candy.");

    elseif (al == 'S') then

         stdout.put("S is for Soda");

    else

         stdout.put((type char al), " not recognized.");

    endif;

    Answer:

Total points for this book learning challenge:

150 points