aboutsummaryrefslogtreecommitdiff
path: root/amforth-6.5/msp430/lib/forth-2012/core
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2017-08-19 12:15:28 +0200
committerDimitri Sokolyuk <demon@dim13.org>2017-08-19 12:15:28 +0200
commit67d25d837ac55f28a366c0a3b262e439a6e75fc3 (patch)
treedf7715c7724c5935ab87c807f3b8b4ef529315e3 /amforth-6.5/msp430/lib/forth-2012/core
parente0d6784e89dba33226c0edb815bb974486fa7c48 (diff)
Add AmForth
Diffstat (limited to 'amforth-6.5/msp430/lib/forth-2012/core')
-rw-r--r--amforth-6.5/msp430/lib/forth-2012/core/c-comma.frt5
-rw-r--r--amforth-6.5/msp430/lib/forth-2012/core/environment-q.frt28
-rw-r--r--amforth-6.5/msp430/lib/forth-2012/core/evaluate.frt22
-rw-r--r--amforth-6.5/msp430/lib/forth-2012/core/star-slash-mod.frt6
-rw-r--r--amforth-6.5/msp430/lib/forth-2012/core/value.frt9
5 files changed, 70 insertions, 0 deletions
diff --git a/amforth-6.5/msp430/lib/forth-2012/core/c-comma.frt b/amforth-6.5/msp430/lib/forth-2012/core/c-comma.frt
new file mode 100644
index 0000000..8741509
--- /dev/null
+++ b/amforth-6.5/msp430/lib/forth-2012/core/c-comma.frt
@@ -0,0 +1,5 @@
+
+\ only a dummy file for certain use cases like
+\ the hayes tester. The actual definition is
+\ already in the words/ directory
+
diff --git a/amforth-6.5/msp430/lib/forth-2012/core/environment-q.frt b/amforth-6.5/msp430/lib/forth-2012/core/environment-q.frt
new file mode 100644
index 0000000..3ba440f
--- /dev/null
+++ b/amforth-6.5/msp430/lib/forth-2012/core/environment-q.frt
@@ -0,0 +1,28 @@
+\ environment queries are placed in a
+\ separate wordlist.
+
+: environment? \ addr len -- 0|x*i -1
+ environment search-wordlist dup
+ if >r execute r> then
+;
+
+\ some environment queries
+
+\ save the definitions word list for this file
+\ and switch to the environment queries wordlist
+get-current environment set-current
+
+: /counted-strings &60 ;
+: floored 0 ;
+: address-unit-bits $10 ;
+: max-char $ff ;
+: max-d $7fffffff. ;
+: max-ud $ffffffff. ;
+: max-n $7fff ;
+: max-u $ffff ;
+
+: return-stack-cells &10 ;
+: stack-cells &10 ;
+
+\ reset the definition word list
+set-current
diff --git a/amforth-6.5/msp430/lib/forth-2012/core/evaluate.frt b/amforth-6.5/msp430/lib/forth-2012/core/evaluate.frt
new file mode 100644
index 0000000..9f4cf3b
--- /dev/null
+++ b/amforth-6.5/msp430/lib/forth-2012/core/evaluate.frt
@@ -0,0 +1,22 @@
+\ evaluate
+\ temporarily redirect the input source
+\ to string buffer. Return the the previous
+\ input source afterwards and continue
+
+\ some helper words
+variable strlen
+variable str
+: source-string str @ strlen @ ;
+
+: evaluate \ i*x addr len -- j*y
+ ['] source defer@ >r
+ >in @ >r
+ 0 >in !
+ strlen !
+ str !
+ ['] source-string to source
+ ['] interpret catch
+ r> >in !
+ r> to source
+ throw
+;
diff --git a/amforth-6.5/msp430/lib/forth-2012/core/star-slash-mod.frt b/amforth-6.5/msp430/lib/forth-2012/core/star-slash-mod.frt
new file mode 100644
index 0000000..741b4cd
--- /dev/null
+++ b/amforth-6.5/msp430/lib/forth-2012/core/star-slash-mod.frt
@@ -0,0 +1,6 @@
+
+\ MSP has another division type
+
+: */mod ( )
+ >r m* r> fm/mod
+;
diff --git a/amforth-6.5/msp430/lib/forth-2012/core/value.frt b/amforth-6.5/msp430/lib/forth-2012/core/value.frt
new file mode 100644
index 0000000..41a7e70
--- /dev/null
+++ b/amforth-6.5/msp430/lib/forth-2012/core/value.frt
@@ -0,0 +1,9 @@
+\ the value (in RAM)
+
+: value ( n -- )
+ (value)
+ here , \ compile the RAM address
+ ['] @ ,
+ ['] ! ,
+ here ! 2 allot
+;