uxn

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

commit 8d90298e572cad76d7dd4bd3fedb8b11849c389e
parent 1d4ae74e414f52ca137ab6c40ebdf4935968f74a
Author: Devine Lu Linvega <aliceffekt@gmail.com>
Date:   Thu,  1 Jun 2023 21:53:28 -0700

(fib.tal) Improved example

Diffstat:
Mprojects/examples/exercises/fib.tal | 36++++++++++++++++++++++++++----------
1 file changed, 26 insertions(+), 10 deletions(-)

diff --git a/projects/examples/exercises/fib.tal b/projects/examples/exercises/fib.tal @@ -2,21 +2,37 @@ A series of numbers where the next number is made of the two numbers before it ) -|0100 ( -> ) @reset +|100 - #0000 INC2k ADD2k - &loop - DUP2 print #0a18 DEO - ADD2k LTH2k ?&loop - ( halt ) + #0019 #0000 + &l + DUP2 pdec #2018 DEO + DUP2 fib pdec #0a18 DEO + INC2 GTH2k ?&l + POP2 POP2 #010f DEO BRK -@print ( short* -- ) +@fib ( num -- numfib* ) + #0001 GTH2k ?&ok + POP2 JMP2r &ok + SUB2k fib STH2 INC2 + SUB2 fib STH2r + ADD2 +JMP2r + +@pdec ( short* -- ) - SWP print/byte - &byte ( byte -- ) DUP #04 SFT print/char - &char ( char -- ) #0f AND DUP #09 GTH #27 MUL ADD #30 ADD #18 DEO + #2710 LIT2r 00fb + &w + DIV2k #000a DIV2k MUL2 SUB2 SWPr + EQUk OVR STHkr EQU AND ?&skip + DUP LIT "0 ADD #19 DEO INCr + &skip + POP2 #000a DIV2 + SWPr INCr STHkr ?&w + POP2r POP2 POP2 JMP2r +