1. Write AVR assembly code to subtract 54 from 203 (203-54). You do not need to include any directives, code snippets are ok. What register will the answer be stored in? (4 points)
  2. Write AVR assembly code to add the two numbers 307 and 562. You do not need to include any directives, code snippets are ok. You may find the instruction addc helpful here. What registers are the answer stored in? (4 points)
  3. What are the three types of memory on an AVR and when would you use each?
    (6 points)
  4. What are the three ways an operation can access data? (6 points)
  5. Explain what the AVR instructions “call” and “ret” do. What do they push to/pop from the stack? How does this affect the program flow? (4 points)
  6. Consider the registers below.
    R16: 0110 1110
    R17: 1101 1011
    R18: 0110 1011

    1. If the following code is run, what is contained in each register? (3 points)
      push r16
      push r17
      push r18
      pop r16
      pop r17
      pop r18
    2. If the following code is run, what is contained in each register? (3 points)
      push r16
      push r17
      push r18
      pop r18
      pop r17
      pop r16