汇编语言的简答入门--斐波那契数列(递归)

来源:互联网 发布:百度人工智能api 编辑:程序博客网 时间:2024/06/05 16:57
TITLE Save an array and dispalyINCLUDE Irvine32.inc.dataarray DWORD 12 DUP (?)   ; define a array for saving Fibonacci numbersstep = type arraynum DWORD ?count DWORD ?prompt byte "The first twelve fibonacci numbers are ",0prompt1 DWORD "  ",0.codemain PROCmov edx,offset promptcall writestringmov ebx,0                 ;they are for calculateing the value of arraymov edx,1                 ;mov ebp,0                 ;mov ecx,11                ;for outputingmov eax,00hdisplay:push eaxcall Fibonaccipop eaxcall writeintadd eax,01hloop display    call crlf    call waitmsg          exitmain ENDPFibonacci proc USES esi eax ebx edx ebpmov esi,espadd esi,24mov eax,[esi]                ;get the value of we have pushed itcmp eax,1jl L1                                         add ebp,ebx                  ;calculate the value of arrayadd ebp,edx                  ;mov ebx,edx                  ;mov edx,ebp                  ;dec eax                      ;the times of recursioncall FibonacciL1:mov [esi],ebp            ;result return addressretloop L1Fibonacci ENDPEND main                     


 

输出有错误请求各位兄长学长帮忙!感激不尽。

 

原创粉丝点击