48SX Fibonacci (with a few tricks)
|
04-25-2018, 01:58 PM
(This post was last modified: 04-25-2018 02:21 PM by SamE.)
Post: #1
|
|||
|
|||
48SX Fibonacci (with a few tricks)
So, I'm new on the forums and own an 11C, a 28S, and a 48SX. I was wondering how to make a program of the Fibonacci sequence that left the numbers on the stack. The code that I use normally is:
-start with 2 1s on the stack- << DO DUP ROT + CLLCD DUP 5 DISP 1 WAIT UNTIL KEY END >> This displays the numbers but doesn't leave them on the stack. Trying to hide their hp obsession from their friends. |
|||
04-25-2018, 03:39 PM
Post: #2
|
|||
|
|||
RE: 48SX Fibonacci (with a few tricks)
(04-25-2018 01:58 PM)SamE Wrote: This displays the numbers but doesn't leave them on the stack. Welcome to the forum, SamE! You've got a good start on this already. Using the same basic structure as what you already have above, here's one way to leave the numbers on the stack as they are being displayed: Code: « Notes: - I moved the CLLCD outside of the loop, as it doesn't really need to be executed each time. - Since you need to start with two 1s on the stack, I went ahead and included that as a convenience. - "DO ... UNTIL KEY END" leaves the pressed key code on the stack. That isn't a part of the sequence, so I thought it might be good to DROP it at the end instead of leaving it in place. |
|||
04-25-2018, 06:56 PM
Post: #3
|
|||
|
|||
RE: 48SX Fibonacci (with a few tricks)
That is exactly what I needed and works great! Thanks.
Trying to hide their hp obsession from their friends. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)