PE1) First 20 Fibonacci

Write a program that uses a loop to calculate at least the first 20 values of the Fibonacci number sequence.

.386
.model flat,stdcall
.stack 4096
ExitProcess PROTO, dwExitCode:DWORD

.data
fibonacci DWORD 20 DUP(?)
result DWORD 0
.code
main PROC
	mov esi, OFFSET fibonacci            ;esi points to the beginning of fib array
	mov ecx, LENGTHOF fibonacci-1        ;Loop counter ecx = 6
	mov eax, 0
	mov ebx, 1

	mov [esi], eax                       ;1st element in Fibarray = 0
	add esi, TYPE fibonacci	             ;increment array

	mov [esi], ebx                       ;2nd element in Fibarray = 1
	add esi, TYPE fibonacci              ;increment array

L2:
	mov eax, [esi-8]                ;eax = value of the 2 elements before esi is pointing at
	mov ebx, [esi-4]                ;eax = value of the previous element before esi is pointing at
	mov edx, eax
	add edx, ebx                         ;edx = eax + ebx
	mov [esi], edx                       ;store value in edx in fib array
	add esi, TYPE fibonacci              ;increment esi
loop L2

INVOKE ExitProcess,0
main ENDP
END main

Show Code