2014-05-14 21:34:53 +02:00
|
|
|
def fibonaccit(n) # n == r0
|
|
|
|
a = 0 # a == r1
|
|
|
|
b = 1 # b = r2
|
|
|
|
while( n > 1 ) do #BUG comment lines + comments behind function calls
|
|
|
|
tmp = a # r3 <- r1
|
|
|
|
a = b # r1 <- r2
|
|
|
|
b = tmp + b # r4 = r2 + r3 (r4 transient) r2 <- r4
|
2014-05-18 11:30:49 +02:00
|
|
|
tmp = putint(b)
|
2014-05-15 15:54:23 +02:00
|
|
|
putstring(tmp)
|
2014-05-14 21:34:53 +02:00
|
|
|
n = n - 1 # r2 <- 0 ???? #call ok
|
|
|
|
end #r5 <- r0 - 1 # r0 <- r5
|
2014-05-10 18:02:51 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
fibonaccit( 10 )
|