Assembly Language Programming D FAST-NU, Lahore, Spring 2018
Assembly Language Programming D FAST-NU, Lahore, Spring 2018
Homework 1
Write code for the following problems. Submit soft copies via SLATE.
1) Declare three arrays arr1, arr2 and arr3, each of size stored in a variable called
size. Write code that adds the corresponding numbers in arr1 and arr2 and
stores their sums in arr3.
2) Declare a byte array arr1 (each of its elements is a byte) of size stored in a word
variable called size. Write code to rotate the elements of arr1 toward right once.
3) Create a sorted array of integers arr1 and store its size in a variable called size.
Write code to find the number which repeats the most number of times in arr1.
Store this number in a variable called num1 and store the number of times it
repeats in a variable called count1.
4) Create two arrays arr1 and arr2 whose each element is a byte. These arrays are
of equal size, stored in a variable called size. Both arr1 and arr2 represent
numbers of size-many digits – i.e. the entire array is considered a single number
with the elements of the array being its digits. Write code to add these two
numbers byte by byte to produce the sum in a third array called arr3. Be careful
that while adding two bytes the sum may generate a carry and this needs to be
carried to the next addition. Look into the instruction: ADC for this purpose. If the
overall addition generates an end carry set a flag variable called flag1, otherwise
clear it to zero.
THE END