EEE 105 Lab Exercise 1: Introduction To Assembly Language Programming
EEE 105 Lab Exercise 1: Introduction To Assembly Language Programming
Introduction
For this exercise, you will be creating a program - first, in C-like pseudo code - and then converting it
to assembly language using the provided instruction set in Table 1.
Given integers M and N stored in memory addresses 0x01 and 0x02, respectively, your program should
compute for the sum of the squares of the integers from M to N, inclusive, and the result should be stored
in memory address 0x03. Note that N is greater than or equal to M, and that N and M are always greater
than zero. You should also determine whether the resulting sum is either even or odd. If it is odd, store a
value of 0x1 at memory address 0x04, whereas if the sum is even, store a value of 0x2 at memory address
0x04.
The exercise is worth 15 points.
Instruction set
1
For this exercise, you may use a maximum of six registers (Reg0 to Reg5). Assume that all registers start
with an initial value of 0. Although an unconditional branch operation (JUMP) is available, try to minimize
/ avoid its usage to minimize the labels in the program for a ’better-looking’ flow.
Example
• Sample input 1: M = 3, N = 10
sum = 32 + 42 + 52 + 62 + 72 + 82 + 92 + 102
sum = 380
• Sample input 3: M = 5, N = 13
sum = 52 + 62 + ... + 132
sum = 789