Question: ou will turn in TWO different . asm files. They will be called FirstLastLab 3 Q 1 . asm and FirstLastLab 3 Q 2 .

ou will turn in TWO different .asm files. They will be called FirstLastLab3Q1.asm and FirstLastLab3Q2.asm.
Use your first and last name in place of First and Last. Use the file template.asm or addtwo.asm as a guide when
creating your programs. A portion of your grade will be based on program comments, indentation, spacing, and other
coding conventions that are used in class.
Question 1: File Name: FirstLastLab3Q1.asm
Create a program that will sum the double gaps between consecutive array element values. The array will be
of DWORDS.
o Example:
Given the following array: myArray DWORD 2,7,8,12
The gaps between the numbers are 5,1, and 4. Doubling these values (double gaps) give us 10,
2, and 8. Add these together and the result is 20.
Store the result in a variable named doubleGapSum.
This program should work for an array with any number of elements (without changing anything other than the
array itself). I will test with various array lengths. The array is guaranteed to have at least two elements.
Make sure that you use ESI when accessing different elements of the array.
Question 2: File Name: FirstLastLab3Q2.asm
Create a program that will calculate the first n elements of the Fibonacci number sequence.
Create a symbolic constant called n and assign any value to it. This will be the number of Fibonacci numbers
that will be generated.
Create an array of DWORDS called fibonacciNumbers. Initialize this array to all zeros. The number of elements
in this array is determined by the value that you set n to in the prior step.
Your program should fill the fibonacciNumbers array with the first n Fibonacci numbers.
o In case you are not familiar with Fibonacci numbers, the first number is 0, the second number is 1, the
third number is the sum of the first two (0+1=1). The fourth is the sum of numbers 2 and 3(1+1),
and so on. Each number is the sum of the prior two numbers. Here are the first few values of the
sequence: 0,1,1,2,3,5,8,13,21,...
When I test, I will change the value of n. THIS WILL BE THE ONLY THING THAT I CHANGE. Your program should
work regardless of what value I put in there. Be sure to test with different values. You may assume that n >=3
Make sure that you use ESI when accessing different elements of the array.
template.asm:
; Program template
.386
.model flat,stdcall
.stack 4096
ExitProcess proto,dwExitCode:dword
.data
; declare variables here
.code
main proc
; write your code here
invoke ExitProcess,0
main endp
end main

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Accounting Questions!