文件名称:Fibonacci-Sequence
介绍说明--下载内容均来自于网络,请自行研究使用
汇编 菲波那契数列
include irvine32.inc
原理:f3=f2+f1
.data
str1 byte "请输入所求的菲波那契数列的位数:",0
str2 byte "此程序中菲波那契数列最大位置:",0
j dword 2 求最大位置
f1 dword 1,0,0 用3个32位表示一个96位
f2 dword 1,0,0 用3个32位表示一个96位
m dword ?
.code
main proc
mov edx,offset str1
call writestring
call readint
mov m ,eax 所输入的位置
cmp m ,0 判断所输入的数据是否小于0
jng quit
cmp m ,2 判断所输入的数据是否大于2
jng next1 如果小于等于2,则执行next1
sub m ,2
mov ecx ,m 表示循环m次
L1:
mov edx , f1
mov ebx , f1+4
mov eax , f1+8
add edx ,dword ptr f2
adc ebx ,dword ptr f2+4 做带进位的加法,省去判断是否进位
adc eax ,dword ptr f2+8 做带进位的加法,省去判断是否进位
jc next2 判断是否进位,进位则执行next2,也说明超出96位-Compilation Fibonacci series include irvine32.inc principle: f3 = f2+f1. Data str1 byte " Please enter the demand Fibonacci series of median:" , 0 str2 byte " This program Fibonacci column maximum Location: " 0 j dword 2 the biggest position f1 dword 1,0,0 3 32 96 f2 dword 1,0,0 3 32 96 m dword? code main proc mov edx, offset str1 call writestring call readint mov m, eax the input position CMP m, 0 judged by the input data is less than 0 JNG quit CMP m, 2 determines whether the input data is larger than 2 jng next1 less than or equal to 2, the execution next1 sub m 2 mov ecx, m circulation m times L1: mov edx, f1 mov ebx, f1+4 mov eax, f1+8 add edx, dword ptr f2 adc ebx, dword ptr f2+4 to to to do the Carry addition, eliminating the need to determine whether the binary adc eax, dword ptr f2+8 do into a bit addition, eliminating the need to determine whether into a bit jc next2 determine whether the binary, binary is executed next2, also exceeded 96 position
(系统自动生成,下载前可以参看下载内容)
下载文件列表
Fibonacci Sequence\Fibonacci Sequence.rar
..................\菲波那契数列2.asm
Fibonacci Sequence