Assembly Language and the Instruction Set · seed 1 · A4, ink-friendly. The answer key prints on its own page for grown-ups.

Talking straight to the processor

Computing · Computer Systems · ages 16-18
Name ______________________   Date ____________
  1. What is a register?

    • a file saved on the disk
    • a tiny fast slot inside the processor
    • a cable to the printer
  2. Which line is a typical assembly instruction?

    • add the register to the running total
    • print the total with a friendly message
    • solve the whole problem at once
  3. One line of high level code usually becomes several assembly instructions.

    Circle one:   True   False

  4. You hand run a listing. After three lines the total register holds 6 and the counter holds 3. What do you do on line four?

    • guess the final answer from the pattern
    • update the table from here line by line
    • restart from line one with new guesses
  5. In a loop adding 1 to 5, what do compare and branch do?

    • compare prints the total and branch stops the program
    • compare loads the next number and branch stores the total
    • compare sets flags and branch jumps back to repeat
  6. The line total = total + counter becomes load, add, store. Why three instructions?

    • hidden load, add, store each need a line
    • assembly repeats every line three times for safety
    • registers can only hold one program ever
  7. A friend hand runs a listing and reports only the final total, skipping flags and memory. Why is the report untrustworthy?

    • final totals are never needed
    • memory cells cannot change
    • branch choices depend on flags, so untracked flags mean untracked jumps
  8. A loop adding 1 to 5 ends with the counter at 5 but the total at 10. The branch jumps back while the counter is below 5. What is the most likely bug?

    • the compare tests the wrong limit or the wrong register
    • assembly cannot add past 10
    • the halt line runs too early
LightMySky · lightmysky.comW1-mt_bzmsfvdzwp-s1

Answer key

For grown-ups. Fold this page away before handing over the rest.

Talking straight to the processor W1-mt_bzmsfvdzwp-s1

  1. a tiny fast slot inside the processor · Registers hold the values the processor is working on right now.
  2. add the register to the running total · Each line names one basic operation on a register or address.
  3. True · Loading, computing and storing each need their own lines.
  4. update the table from here line by line · Hand running tracks every register line by line from the values just reached.
  5. compare sets flags and branch jumps back to repeat · Compare describes the test in flags, and branch reads the flags to loop or exit.
  6. hidden load, add, store each need a line · Values must reach registers, be combined, then return to memory.
  7. branch choices depend on flags, so untracked flags mean untracked jumps · Without flags you cannot know which branches jumped, so the path itself is a guess.
  8. the compare tests the wrong limit or the wrong register · A total of 10 means only 1 to 4 were added, so the exit test fired one round early.
Worksheet · LightMySky