Alright, I feel like I'm very close to solving this but nothing I do to this seems to work. This program has to create 47 numbers of the fibonacci sequence then store them in an array of DWORDS then write that to a file (fib.bin). The formatting got kind of screwed up but if you need any clarification I will try to help.
INCLUDE Irvine32.inc
.data
fileHandle DWORD ?
filename BYTE "fib.bin", 0
FIB_COUNT = 47
array DWORD FIB_COUNT DUP(?)
.code
main PROC
; Create the file
mov edx,OFFSET filename
call CreateOutputFile
mov fileHandle,eax
; Generate the array of values
mov esi,OFFSET array
mov ecx,FIB_COUNT
call generate_fibonacci
; Write the array to a file
mov eax,fileHandle
mov edx,OFFSET array
mov ecx,SIZEOF array
call WriteToFile
; Close the file
mov eax,fileHandle
call CloseFile
exit
main ENDP
;---------------------------------------------------
generate_fibonacci PROC USES eax ebx ecx
;
; Generates fibonacci values and stores in an array.
; Receives: ESI points to the array, ECX = count
; Returns: nothing
;---------------------------------------------------
mov ebp, 0
mov edx, 1
mov ebx, edx
mov ecx, 47
L1:
mov eax, edx
mov ebp, eax
mov edx, ebx
add ebx, ebp
; dec ecx
loop L1
ret
generate_fibonacci ENDP
END main
I the problem I see is that it's not returning anything and I cannot find out what I need it to return. I've tried it returning various registers but all of them come out with an error.