Difference between revisions of "CSC270 Exercises on Assembly Language"

From dftwiki3
Jump to: navigation, search
(Pause)
(Pause)
Line 53: Line 53:
  
 
<br />
 
<br />
<center>[[Image:6811AddressingModes.png]]</center>
+
<center>[[Image:6811AddressingModes.png|700px]]</center>
 
<br />
 
<br />
 
<br />
 
<br />

Revision as of 15:38, 27 March 2012

--D. Thiebaut 16:20, 27 March 2012 (EDT)


Learning Assembly Through Exercises

Exercise 1

  • Write a program that uses 3 byte variables, a, b, and c. The variable are initialized before the program starts with the values 2, 5, and 0, respectively.
  • The program will add up the contents of the variable a to that of b and store the result into c. Only c will change.

Exercise 2

  • Assemble the program of Exercise 1
  • How many bytes does it contain?
  • How fast will it go from beginning to end, assuming each 6811 cycle is 1 µsecond?

Exercise 3

  • Same as Exercise 1, but for the Pentium.
  • Assuming that the Pentium runs at a clock speed of 3 GHz, how many times could the program run on the Pentium while the same program run on the 1MHz 6811?

Exercise 4

  • We want to compute Y = a + b - c + 3, where Y, a, b, and c are byte variables.
  • Write the program that performs this operation.
  • Assemble the program
  • Count the total number of cycles it will take to run, and the total number of bytes it will use up in RAM.

Exercise 5

FibonacciRabits.png
  • Write a program that computes the first 5 terms of the fibonacci sequence, assuming that your program starts with 5 variables that all zero.
  • Assemble it.
  • How many cycles?
  • How many bytes?










Pause


6811AddressingModes.png