Question: ( 2 ) ( 1 0 points ) Fibonacci Numbers # 5 on page 1 5 0 . Upload source code as Ch 4 _

(2)(10 points) Fibonacci Numbers #5 on page 150. Upload source code as Ch4_2.asm.
Use dup to create an array of 15 integers.
Must use a loop to calculate the remaining Fibonacci numbers.
Include a screen shot of the memory of the array after the loop completes.
(This is what i have so far but the code won't make it past "store new number in array" I'm not sure what im doing wrong. It keeps throwing an exception.)
; Ch4_2.asm - Find the first 15 fibonacci numbers.
.386
.model flat,stdcall
.stack 4096
ExitProcess proto,dwExitCode:dword
.data
fArr word 15 Dup(?)
.code
main proc
mov ecx, 13 ;set up loop counter, we already know the first 2 numbs.
mov si,4 ;bcs of word size 4 starts at third array space
mov fArr[0],1 ;move 1(0001h) into first array space
mov fArr[2],1 ;move 1(0001h) into second space. bcs of word size +2 is the second space
lp: mov ax,[fArr + si -2] ;f(n-1)
mov bx,[fArr + si -4] ;f(n-2)
add ax,bx ;add new number to previous number
mov fArr[si], ax ;store new number in the array
add si,2 ;move word size over to the next space
loop lp
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 Programming Questions!