CSC270 Homework 7

From dftwiki3
Jump to: navigation, search

This assignment is due at the beginning of Lab #8

Problem #1: Assembly

Assemble the following program by hand:

              ORG    0020
      alpha   FCB    11
      beta    FCB    2
      gamma   FCB    3
      delta   FCB    21
      result  FCB    0

              ORG   0000
      start:  ldx   #alpha
              ldaa  0,X
              adda  1,X
              adda  3,X
              adda  2,X
              lsra  
              lsra
              staa  4,X
              jmp   start

When you assemble your program, show the hexadecimal bytes of the opcodes on the left of each instruction, as we did in class.

Add comments to indicate what the program does in each step, and what the number stored in the variable result represents in terms of the other four. The lsra instructions are new. Figure out what they do by looking at the documentation you have available on the 6811. Indicate in your comment what their contribution to the overall computation is, not what happens in the ALU when they are executed.

How many cycles does the program take to execute one loop?

Show the contents of the memory once your program is loaded into it.

Problem #2: Performance Analysis

Rewrite the program above using direct mode instead of indexed mode. Count the number of bytes of code of this new program and compare it to the number of bytes taken by the original program. Comment on the difference, and indicate what mode results in the smallest footprint in memory.

Count the number of cycles taken by your program to execute one loop and compare it to that of the original program. Comment on the difference and indicate which addressing mode results in a faster execution time.

Problem #3: Performance Analysis Revisited

Same questions as for Problem #2, but use extended mode instead of direct mode.