Post Reply 
48SX Fibonacci (with a few tricks)
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:
«
  CLLCD
  1 DUP
  DO
    DUP2 +
    DUP 5 DISP
    1 WAIT
  UNTIL
    KEY
  END
  DROP
»

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.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
48SX Fibonacci (with a few tricks) - SamE - 04-25-2018, 01:58 PM
RE: 48SX Fibonacci (with a few tricks) - DavidM - 04-25-2018 03:39 PM



User(s) browsing this thread: 1 Guest(s)