aboutsummaryrefslogtreecommitdiff
path: root/j1demo/firmware/ans.fs
diff options
context:
space:
mode:
authorDimitri Sokolyuk <ds@doozer.de>2017-05-23 17:06:09 +0200
committerDimitri Sokolyuk <ds@doozer.de>2017-05-23 17:06:09 +0200
commit6f86ce7057dd7cd1b491e8f09501258822d2ea74 (patch)
treeb3bfa11f0f72d0e1ca7c84d948af20b7494dd26b /j1demo/firmware/ans.fs
Import j1demo
Diffstat (limited to 'j1demo/firmware/ans.fs')
-rw-r--r--j1demo/firmware/ans.fs46
1 files changed, 46 insertions, 0 deletions
diff --git a/j1demo/firmware/ans.fs b/j1demo/firmware/ans.fs
new file mode 100644
index 0000000..dcd29ed
--- /dev/null
+++ b/j1demo/firmware/ans.fs
@@ -0,0 +1,46 @@
+( Main file for pure ANS forth JCB 13:53 11/27/10)
+
+: parse-word
+ bl word count ;
+
+: defer create ( "name" -- )
+ ['] abort , does> @ execute ;
+
+: include ( "filename" -- )
+ bl word count included decimal ;
+
+: is ( xt "name" -- )
+ ' ( xt xt2)
+ state @ if
+ postpone literal postpone >body postpone !
+ else
+ >body !
+ then ; immediate
+
+
+: include ( "filename" -- )
+ bl parse included decimal ;
+
+ : Do-Vocabulary ( -- )
+ DOES> @ >R ( )( R: widnew)
+ GET-ORDER SWAP DROP ( wid_n ... wid_2 n)
+ R> SWAP SET-ORDER ;
+
+: VOCABULARY ( "name" -- )
+ WORDLIST CREATE , Do-Vocabulary ;
+
+: -rot rot rot ;
+: nstime 0. ;
+: <= > invert ;
+: >= < invert ;
+: d0<> d0= invert ;
+
+: f> fswap f< ;
+: f<= f> invert ;
+: f>= f< invert ;
+: f= 0e0 f~ ;
+: f<> f= invert ;
+
+3.1415926e0 fconstant pi
+
+include main.fs