aboutsummaryrefslogtreecommitdiff
path: root/docs/j1demo/firmware/ans.fs
diff options
context:
space:
mode:
Diffstat (limited to 'docs/j1demo/firmware/ans.fs')
-rw-r--r--docs/j1demo/firmware/ans.fs46
1 files changed, 46 insertions, 0 deletions
diff --git a/docs/j1demo/firmware/ans.fs b/docs/j1demo/firmware/ans.fs
new file mode 100644
index 0000000..dcd29ed
--- /dev/null
+++ b/docs/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