-1
好吧,我觉得我非常接近解决这个问题,但是我对此做的任何事情似乎都无法解决。 该程序必须创建47个斐波那契数列,然后将它们存储在DWORDS数组中,然后将其写入文件(fib.bin)。格式化有些搞砸了,但如果你需要澄清,我会尽力帮忙。生成Fibonacci序列的数字,并将它们写入文件
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
我看到的问题是它没有返回任何东西,我也找不到我需要返回的东西。我试过它返回各种寄存器,但他们都出来了一个错误。
它输出二进制文件,但它也将打印到控制台。 – David 2011-04-01 02:53:13