Assignment 1 Solution



AVR Assembly Language programming

Setting up AVR Studio 7

Create a new AVR Assembly project named “a1” in AVR Studio 7 by following the instructions documented in your lab2 write-up.

Download the four files:

a1q1.asm, a1q2.asm, a1q3.asm and a1q4.asm

from the connex site under: Resources->Assignments->Assignment1 Place them in the directory where your a1 project was created.

Then add the files to the project by right clicking on the source files tree entry and selecting “Add

Existing Item”:

When you’ve added all the files, your project pane should look similar this. Here, the default main.asm provided by Atmel Studio has been removed and a1q1.asm has been set as the entry file.

In this assignment we are writing four unrelated assembly language programs in the same project. You can select which file you want to work on by right clicking on it and selecting “Set as Entry File”:

So, when you are working on question 2, you will make a1q2.asm the entry file. When you select “run”, it will start the program in a1q2.asm.

Writing the assembly language

Read the comments in each of the .asm files, they contain the specifications on what each of the programs is supposed to do.

Make careful note of the special markers: ;–* and ;* — and be sure you do not change any code between those markers. These special characters are used to facilitate marking.

You should write your code between the line starting with ;*** and the line starting with ;****


Submit your a1q1.asm, a1q2.asm, a1q3.asm and a1q4.asm using connex. Do NOT submit your project file – just the .asm files.


If you submit a program that does not assemble (ie. There are errors during the project build process) you will receive 0 for that part of the assignment.

If you change any code between the ;–* and ;*– markers in the code, you will receive 0 for that part of the assignment.

Your programs will be run on different inputs than those specified in the sample files. If you hard-code your answers, you will receive 0 for that part of the assignment.

Question 1

4 marks

Question 2

4 marks

Question 3

8 marks

Question 4

8 marks


24 marks