Difference between revisions of "CSC270 Homework 7"

From dftwiki3
Jump to: navigation, search
(New page: This assignment is due at the beginning of Lab #8 =Problem #1: Assembly= Assemble the following program by hand: <code><pre> ORG 0020 alpha FCB 11 beta ...)
 
(Problem #1: Assembly)
Line 26: Line 26:
 
When you assemble your program, show the hexadecimal bytes of the opcodes on the left of each instruction, as we did in class.
 
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.
+
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?
 
How many cycles does the program take to execute one loop?
  
Show the contents of the memory once your program is loaded into it.  
+
Show the contents of the memory once your program is loaded into it.
  
 
=Problem #2: Performance Analysis=
 
=Problem #2: Performance Analysis=

Revision as of 14:52, 25 March 2009

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.

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.

Problem #3: Performance Analysis Revisited

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