I have a problem getting my assembly program designed to get the first 47 numbers of the fibonacci series to output to a file. I'm not getting any errors except for when opening command window. This is the exact question on my homework problem if this helps :
Using Programming Exercise 6 in Chapter 4 as a starting point, write a program that generates the first 47 values in the Fibonacci series, stores them in an array of doublewords, and writes the doubleword array to a disk file. You need not perform any error checking on the file inputoutput because conditional processing has not been covered yet. Your output file size should be 188 bytes because each doubleword is 4 bytes. Use debug.exe or Visual Studio to open and inspect the file contents, shown here in hexadecimal.
INCLUDE Irvine32.inc
.data
FIB_COUNT = 45 ; number of values to generate after first 2 1's
fileHandle DWORD ?
filename BYTE "a.bin",0
array DWORD FIB_COUNT DUP(?)
temp1 DWORD ?
temp2 DWORD ?
temp3 DWORD ?
.code
main PROC
mov esi,OFFSET array
mov array[esi],1
mov eax,[esi]
mov temp1,eax
add esi,4
mov array[esi],1
mov eax,[esi]
mov temp2,eax
add esi,4
mov ecx, FIB_COUNT
fibgenerator:
mov eax,0
mov ebx,0
mov eax,temp1
mov ebx,temp2
add eax,ebx
mov temp3,eax
mov array[esi],eax
mov temp1,ebx
mov temp2,eax
add esi,4
loop fibgenerator
mov edx,OFFSET filename
call CreateOutputFile
mov eax, fileHandle
mov edx,OFFSET filename
mov ecx,188
call WriteToFile
mov eax,filehandle
call CloseFile
exit
main ENDP
END main