X-Git-Url: https://git.rrq.au/?a=blobdiff_plain;f=sys.f;h=09963525c9e3a9f343efdafd87bbf476ca05a252;hb=3e21454c3e1e006a38d2a05d856e4651d099b668;hp=cab2ab7173df3f16b69381af1c9659e0cd19629a;hpb=f0c2dc0d5c5862f15704fb88d7bbb262391b4b6c;p=rrq%2Fjonasforth.git diff --git a/sys.f b/sys.f index cab2ab7..0996352 100644 --- a/sys.f +++ b/sys.f @@ -33,3 +33,29 @@ EXIT [ SWAP DUP HERE @ SWAP - SWAP ! ; +: BEGIN IMMEDIATE + HERE @ +; + +: UNTIL IMMEDIATE + ' 0BRANCH , + HERE @ - , +; + +: FIB + 0 1 + 0 + BEGIN + ROT + DUP ROT + + ROT ROT + + 1 + + DUP 4 PICK = UNTIL + DROP SWAP DROP SWAP DROP +; + +S" 10 FIB = " TELL +10 FIB .U +S" (Expected: 59)" TELL NEWLINE +