uxn

Varvara Ordinator, written in ANSI C(SDL2)
git clone https://git.eamoncaddigan.net/uxn.git
Log | Files | Refs | README | LICENSE

commit 1993eb9b5fd57a65fc1658db22290daa58d20929
parent f87c15c8b5274546a2198c35f5a6e30094f8f004
Author: neauoire <aliceffekt@gmail.com>
Date:   Wed, 23 Feb 2022 15:23:38 -0800

(fib.tal) Added fib example

Diffstat:
Aprojects/examples/exercises/fib.tal | 24++++++++++++++++++++++++
1 file changed, 24 insertions(+), 0 deletions(-)

diff --git a/projects/examples/exercises/fib.tal b/projects/examples/exercises/fib.tal @@ -0,0 +1,24 @@ +( The Fibonacci Sequence + A series of numbers where the next number is made of the two numbers before it ) + +%HALT { #010f DEO } +%EMIT { #18 DEO } +%PRINT { DUP2 ,print JSR #0a EMIT } + +|0100 ( -> ) + + #0000 INC2k + &loop + ( fib ) ADD2k PRINT + ADD2k LTH2k ,&loop JCN + HALT + +BRK + +@print ( short* -- ) + + &short ( short* -- ) SWP ,&byte JSR + &byte ( byte -- ) DUP #04 SFT ,&char JSR + &char ( char -- ) #0f AND DUP #09 GTH #27 MUL ADD #30 ADD EMIT + +JMP2r