0 Members and 2 Guests are viewing this topic.
:Copy(L1,Str0+1,8)
Lbl FactIf r1 <= 11:ReturnEndr1*Fact(r1-1):Return
For some reason, even a simple factorial program did not work correctly for me.Code: [Select]Lbl FactIf r1 <= 11:ReturnEndr1*Fact(r1-1):ReturnCan somebody post a working sample?
EDIT: In your code, r1 gets overwritten. You need to call FACT as sub(FACTr,r1-1).
Lbl Fact!If Return +1EndReturn *(-1Fact())
They are fine with recursion, it just takes a lot of memory the way Axe does it, since it backs up all 6 variables each time you call the routine
My Fibonacci program just causes a RAM Clear, probably due to a stack overflow. Z80 processors aren't very good with recursion, are they?