aboutsummaryrefslogtreecommitdiff
path: root/amforth-6.5/common/lib/forth2012
diff options
context:
space:
mode:
Diffstat (limited to 'amforth-6.5/common/lib/forth2012')
-rw-r--r--amforth-6.5/common/lib/forth2012/blocks/blocks.frt68
-rw-r--r--amforth-6.5/common/lib/forth2012/blocks/list-dump.frt10
-rw-r--r--amforth-6.5/common/lib/forth2012/blocks/list.frt24
-rw-r--r--amforth-6.5/common/lib/forth2012/blocks/load.frt20
-rw-r--r--amforth-6.5/common/lib/forth2012/core-ext/case-test.frt7
-rw-r--r--amforth-6.5/common/lib/forth2012/core-ext/case.frt35
-rw-r--r--amforth-6.5/common/lib/forth2012/core-ext/compile-comma.frt3
-rw-r--r--amforth-6.5/common/lib/forth2012/core-ext/defers.frt23
-rw-r--r--amforth-6.5/common/lib/forth2012/core-ext/exceptions.frt15
-rw-r--r--amforth-6.5/common/lib/forth2012/core-ext/roll.frt7
-rw-r--r--amforth-6.5/common/lib/forth2012/core/2over.frt8
-rw-r--r--amforth-6.5/common/lib/forth2012/core/2swap.frt3
-rw-r--r--amforth-6.5/common/lib/forth2012/core/action-of.frt14
-rw-r--r--amforth-6.5/common/lib/forth2012/core/blank.frt4
-rw-r--r--amforth-6.5/common/lib/forth2012/core/buffer.frt6
-rw-r--r--amforth-6.5/common/lib/forth2012/core/char-plus.frt3
-rw-r--r--amforth-6.5/common/lib/forth2012/core/chars.frt3
-rw-r--r--amforth-6.5/common/lib/forth2012/core/count.frt3
-rw-r--r--amforth-6.5/common/lib/forth2012/core/dot-paren.frt5
-rw-r--r--amforth-6.5/common/lib/forth2012/core/erase.frt6
-rw-r--r--amforth-6.5/common/lib/forth2012/core/find.frt21
-rw-r--r--amforth-6.5/common/lib/forth2012/core/is.frt12
-rw-r--r--amforth-6.5/common/lib/forth2012/core/move.frt5
-rw-r--r--amforth-6.5/common/lib/forth2012/core/source-id.frt5
-rw-r--r--amforth-6.5/common/lib/forth2012/core/star-slash.frt4
-rw-r--r--amforth-6.5/common/lib/forth2012/core/values.frt16
-rw-r--r--amforth-6.5/common/lib/forth2012/double.frt9
-rw-r--r--amforth-6.5/common/lib/forth2012/double/2-fetch.frt7
-rw-r--r--amforth-6.5/common/lib/forth2012/double/2-store.frt7
-rw-r--r--amforth-6.5/common/lib/forth2012/double/2constant.frt6
-rw-r--r--amforth-6.5/common/lib/forth2012/double/2nip.frt4
-rw-r--r--amforth-6.5/common/lib/forth2012/double/2rot.frt3
-rw-r--r--amforth-6.5/common/lib/forth2012/double/2tuck.frt3
-rw-r--r--amforth-6.5/common/lib/forth2012/double/2variable.frt4
-rw-r--r--amforth-6.5/common/lib/forth2012/double/d-equal.frt2
-rw-r--r--amforth-6.5/common/lib/forth2012/double/d-greater-zero.frt8
-rw-r--r--amforth-6.5/common/lib/forth2012/double/d-greater.frt3
-rw-r--r--amforth-6.5/common/lib/forth2012/double/d-less-zero.frt2
-rw-r--r--amforth-6.5/common/lib/forth2012/double/d-less.frt5
-rw-r--r--amforth-6.5/common/lib/forth2012/double/d-max.frt3
-rw-r--r--amforth-6.5/common/lib/forth2012/double/d-min.frt2
-rw-r--r--amforth-6.5/common/lib/forth2012/double/d-plusstore.frt4
-rw-r--r--amforth-6.5/common/lib/forth2012/double/d-zero-equal.frt3
-rw-r--r--amforth-6.5/common/lib/forth2012/double/m-plus.frt2
-rw-r--r--amforth-6.5/common/lib/forth2012/double/m-star-slash.frt7
-rw-r--r--amforth-6.5/common/lib/forth2012/facility.frt3
-rw-r--r--amforth-6.5/common/lib/forth2012/facility/ms.frt3
-rw-r--r--amforth-6.5/common/lib/forth2012/facility/structures-array.frt24
-rw-r--r--amforth-6.5/common/lib/forth2012/facility/structures-test.frt16
-rw-r--r--amforth-6.5/common/lib/forth2012/facility/structures.frt24
-rw-r--r--amforth-6.5/common/lib/forth2012/facility/time-and-date.frt33
-rw-r--r--amforth-6.5/common/lib/forth2012/file/paren.frt11
-rw-r--r--amforth-6.5/common/lib/forth2012/memory.frt2
-rw-r--r--amforth-6.5/common/lib/forth2012/search-order.frt10
-rw-r--r--amforth-6.5/common/lib/forth2012/search/also.frt8
-rw-r--r--amforth-6.5/common/lib/forth2012/search/definitions.frt8
-rw-r--r--amforth-6.5/common/lib/forth2012/search/forth.frt10
-rw-r--r--amforth-6.5/common/lib/forth2012/search/get-order.frt5
-rw-r--r--amforth-6.5/common/lib/forth2012/search/only.frt7
-rw-r--r--amforth-6.5/common/lib/forth2012/search/order.frt9
-rw-r--r--amforth-6.5/common/lib/forth2012/search/previous.frt8
-rw-r--r--amforth-6.5/common/lib/forth2012/search/set-order.frt13
-rw-r--r--amforth-6.5/common/lib/forth2012/string/search.frt23
-rw-r--r--amforth-6.5/common/lib/forth2012/string/split.frt15
-rw-r--r--amforth-6.5/common/lib/forth2012/string/trailing.frt10
-rw-r--r--amforth-6.5/common/lib/forth2012/tester.frt6
-rw-r--r--amforth-6.5/common/lib/forth2012/tester/anstests.zipbin0 -> 13354 bytes
-rw-r--r--amforth-6.5/common/lib/forth2012/tester/anstests0.9.zipbin0 -> 35058 bytes
-rw-r--r--amforth-6.5/common/lib/forth2012/tester/core.fr1002
-rw-r--r--amforth-6.5/common/lib/forth2012/tester/coreexttest.fth322
-rw-r--r--amforth-6.5/common/lib/forth2012/tester/coreplustest.fth190
-rw-r--r--amforth-6.5/common/lib/forth2012/tester/doubletest.fth386
-rw-r--r--amforth-6.5/common/lib/forth2012/tester/exceptiontest.fth96
-rw-r--r--amforth-6.5/common/lib/forth2012/tester/filetest.fth193
-rw-r--r--amforth-6.5/common/lib/forth2012/tester/memorytest.fth93
-rw-r--r--amforth-6.5/common/lib/forth2012/tester/postponetest.fs379
-rw-r--r--amforth-6.5/common/lib/forth2012/tester/searchordertest.fth178
-rw-r--r--amforth-6.5/common/lib/forth2012/tester/searchordertest.txt184
-rw-r--r--amforth-6.5/common/lib/forth2012/tester/stringtest.fth161
-rw-r--r--amforth-6.5/common/lib/forth2012/tester/tester-amforth.frt66
-rw-r--r--amforth-6.5/common/lib/forth2012/tester/toolstest.fth172
-rw-r--r--amforth-6.5/common/lib/forth2012/tools.frt6
-rw-r--r--amforth-6.5/common/lib/forth2012/tools/bracket-conditional.frt20
-rw-r--r--amforth-6.5/common/lib/forth2012/tools/defined.frt10
-rw-r--r--amforth-6.5/common/lib/forth2012/tools/dot-s.frt3
-rw-r--r--amforth-6.5/common/lib/forth2012/tools/dump.frt50
-rw-r--r--amforth-6.5/common/lib/forth2012/tools/dumper.frt57
-rw-r--r--amforth-6.5/common/lib/forth2012/tools/name2compile.frt9
-rw-r--r--amforth-6.5/common/lib/forth2012/tools/name2interpret.frt4
-rw-r--r--amforth-6.5/common/lib/forth2012/tools/question.frt4
-rw-r--r--amforth-6.5/common/lib/forth2012/tools/see.frt56
-rw-r--r--amforth-6.5/common/lib/forth2012/tools/synonym.frt12
92 files changed, 4315 insertions, 0 deletions
diff --git a/amforth-6.5/common/lib/forth2012/blocks/blocks.frt b/amforth-6.5/common/lib/forth2012/blocks/blocks.frt
new file mode 100644
index 0000000..c11be70
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/blocks/blocks.frt
@@ -0,0 +1,68 @@
+\
+\ simple block wordset
+\ single buffer management.
+\ non-standard block size (to save RAM).
+\ only basic routines. No hardware access
+\
+
+#require defer.frt
+#require buffer.frt
+
+\ high level blocksize, ANS94 says 1024 bytes, SD Cards have 512
+#512 constant blocksize
+variable scr
+
+\ API for low level drivers. They get the
+\ buffer address in RAM and the block number.
+Rdefer load-buffer ( buf-addr u -- )
+Rdefer save-buffer ( buf-addr u -- )
+
+\ single buffer blocks.
+variable blk1
+variable blk1-dirty
+blocksize buffer: blk1-buffer
+
+\ for turnkey
+: block:init
+ -1 blk1 !
+ 0 blk1-dirty !
+;
+
+: update -1 blk1-dirty ! ;
+: updated? ( u -- f )
+ blk1 @ = if
+ blk1-dirty @
+ else
+ 0
+ then
+;
+
+\ reloads the block only if the blocknumber differs
+: block ( u -- a-addr )
+ dup blk1 @ = if drop else
+ blk1 @ updated? if
+ blk1-buffer blk1 @ save-buffer
+ then
+ blk1-buffer swap dup blk1 ! load-buffer
+ 0 blk1-dirty !
+ then
+ blk1-buffer
+;
+
+\ a buffer is an un-initialized block.
+: buffer ( u -- a-addr ) block ;
+
+: save-buffers
+ blk1 @ updated? if
+ blk1-buffer blk1 @ save-buffer
+ then
+ 0 blk1-dirty !
+;
+
+: empty-buffers
+ -1 blk1 !
+ 0 blk1-dirty !
+;
+
+: flush save-buffers empty-buffers ;
+
diff --git a/amforth-6.5/common/lib/forth2012/blocks/list-dump.frt b/amforth-6.5/common/lib/forth2012/blocks/list-dump.frt
new file mode 100644
index 0000000..28a0df7
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/blocks/list-dump.frt
@@ -0,0 +1,10 @@
+
+\ a trivial list in hexdump format
+#require dump.frt
+
+: list
+ dup scr !
+ buffer blocksize dump
+ scr @ updated? 0= if ." not " then ." modified" cr
+;
+
diff --git a/amforth-6.5/common/lib/forth2012/blocks/list.frt b/amforth-6.5/common/lib/forth2012/blocks/list.frt
new file mode 100644
index 0000000..2520aeb
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/blocks/list.frt
@@ -0,0 +1,24 @@
+
+\ a list in text format. not suitable
+\ for binary data!
+
+\ #16 constant #lines
+\ #64 constant #cols
+
+ #8 constant #lines
+#64 constant #cols
+
+: list ( blk -- ) \ list selected screen
+ dup scr !
+ dup cr ." Listing of screen (" .
+ dup updated? if ." not " then ." modified)" cr
+ buffer
+ #lines 0
+ do
+ cr i 0 <# [char] : hold # # #> type space
+ dup i #cols * +
+ #cols type
+ [char] | emit
+ loop
+ cr
+ ;
diff --git a/amforth-6.5/common/lib/forth2012/blocks/load.frt b/amforth-6.5/common/lib/forth2012/blocks/load.frt
new file mode 100644
index 0000000..55cd14b
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/blocks/load.frt
@@ -0,0 +1,20 @@
+\ load a block and evaluate its content
+\
+: source-block1
+ blk1-buffer blocksize
+;
+
+: load ( i*x n -- j*y )
+ ['] source defer@ >r >in @ >r
+ 0 >in !
+ buffer drop
+ ['] source-block1 is source
+ ['] interpret catch
+ r> >in ! r> is source
+ throw
+;
+
+
+: thru ( i*x n1 n2 -- j*y )
+ 1+ swap ?do i load loop
+;
diff --git a/amforth-6.5/common/lib/forth2012/core-ext/case-test.frt b/amforth-6.5/common/lib/forth2012/core-ext/case-test.frt
new file mode 100644
index 0000000..ad9b1f1
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/core-ext/case-test.frt
@@ -0,0 +1,7 @@
+ : foo ( selector -- )
+ case
+ 3 of ." three" endof
+ 5 9 range of ." between" endof
+ 1 of ." one" endof
+ endcase
+ ;
diff --git a/amforth-6.5/common/lib/forth2012/core-ext/case.frt b/amforth-6.5/common/lib/forth2012/core-ext/case.frt
new file mode 100644
index 0000000..02e73f1
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/core-ext/case.frt
@@ -0,0 +1,35 @@
+\ From: eaker@ukulele.crd.ge.com (Chuck Eaker)
+\ Subject: Re: Wanted .. CASE,OF,ENDOF,ENDCASE
+\ Message-ID: <1992Nov25.164255.23225@crd.ge.com>
+\ Date: 25 Nov 92 16:42:55 GMT
+
+: case 0 ; immediate
+: of ( #of -- orig #of+1 / x -- )
+ 1+ ( count OFs )
+ >r ( move off the stack in case the control-flow )
+ ( stack is the data stack. )
+ postpone over postpone = ( copy and test case value )
+ postpone if ( add orig to control flow stack )
+ postpone drop ( discards case value if = )
+ r> ; ( we can bring count back now )
+ immediate
+
+: endof ( orig1 #of -- orig2 #of )
+ >r ( move off the stack in case the control-flow )
+ ( stack is the data stack. )
+ postpone else
+ r> ; ( we can bring count back now )
+ immediate
+
+: endcase ( orig 1..orign #of -- )
+ postpone drop ( discard case value )
+ 0 ?do
+ postpone then
+ loop ;
+ immediate
+
+
+ \ from Message-ID: <ggo2up$67k$1@news-01.bur.connect.com.au>
+: range ( selector low high -- selector x )
+ 2>r dup dup 2r> within
+ 0= if invert then ;
diff --git a/amforth-6.5/common/lib/forth2012/core-ext/compile-comma.frt b/amforth-6.5/common/lib/forth2012/core-ext/compile-comma.frt
new file mode 100644
index 0000000..3845e6c
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/core-ext/compile-comma.frt
@@ -0,0 +1,3 @@
+\ append the XT to the dictionary
+( xt -- )
+: compile, , ;
diff --git a/amforth-6.5/common/lib/forth2012/core-ext/defers.frt b/amforth-6.5/common/lib/forth2012/core-ext/defers.frt
new file mode 100644
index 0000000..25b9505
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/core-ext/defers.frt
@@ -0,0 +1,23 @@
+
+\ various defer definitions
+\ platform specific examples are available !
+
+\ place the XT in RAM, suitable for frequent changes
+\ but needs to be initialized at startup
+
+: Rdefer ( "name" -- )
+ (defer)
+ here ,
+ ['] Rdefer@ ,
+ ['] Rdefer! ,
+ 2 allot
+;
+
+\ use the user area to hold the XT. Similiar to
+\ Rdefer but task lokal in multitasking applications
+: Udefer ( u "name" -- )
+ (defer)
+ , \
+ ['] Udefer@ ,
+ ['] Udefer! ,
+;
diff --git a/amforth-6.5/common/lib/forth2012/core-ext/exceptions.frt b/amforth-6.5/common/lib/forth2012/core-ext/exceptions.frt
new file mode 100644
index 0000000..ec175a0
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/core-ext/exceptions.frt
@@ -0,0 +1,15 @@
+\ ******************************************
+\ some exceptions
+\ ******************************************
+
+: ?throw ( f exc -- )
+ swap if throw then drop
+;
+
+: ?comp ( -- )
+ state @ 0= -&14 ?throw
+;
+
+: ?pairs ( n1 n2 -- )
+ - -&22 ?throw
+;
diff --git a/amforth-6.5/common/lib/forth2012/core-ext/roll.frt b/amforth-6.5/common/lib/forth2012/core-ext/roll.frt
new file mode 100644
index 0000000..385c14a
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/core-ext/roll.frt
@@ -0,0 +1,7 @@
+
+: roll ( x0 x1 .. xn n -- x1 .. xn x0 ) \ core-ext
+ dup 0> 0= if
+ drop
+ else
+ swap >r 1- recurse r> swap
+ then ;
diff --git a/amforth-6.5/common/lib/forth2012/core/2over.frt b/amforth-6.5/common/lib/forth2012/core/2over.frt
new file mode 100644
index 0000000..cf614ca
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/core/2over.frt
@@ -0,0 +1,8 @@
+\ 2over ( w1 w2 w3 w4 -- w1 w2 w3 w4 w1 w2 ) core two_over
+: 2over
+ >r >r
+ over over
+ r>
+ rot rot
+ r>
+ rot rot ;
diff --git a/amforth-6.5/common/lib/forth2012/core/2swap.frt b/amforth-6.5/common/lib/forth2012/core/2swap.frt
new file mode 100644
index 0000000..773228e
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/core/2swap.frt
@@ -0,0 +1,3 @@
+\ 2swap ( w1 w2 w3 w4 -- w3 w4 w1 w2 ) core two_swap
+: 2swap
+ rot >r rot r> ;
diff --git a/amforth-6.5/common/lib/forth2012/core/action-of.frt b/amforth-6.5/common/lib/forth2012/core/action-of.frt
new file mode 100644
index 0000000..894b399
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/core/action-of.frt
@@ -0,0 +1,14 @@
+\ *******************************************
+\ action-of depends on defer@
+\ *******************************************
+
+\ #requires postpone.frt
+
+: action-of
+ state @
+ if
+ postpone ['] postpone defer@
+ else
+ ' defer@
+ then
+; immediate
diff --git a/amforth-6.5/common/lib/forth2012/core/blank.frt b/amforth-6.5/common/lib/forth2012/core/blank.frt
new file mode 100644
index 0000000..a99ae5f
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/core/blank.frt
@@ -0,0 +1,4 @@
+\ fill with blanks
+: blank ( addr n -- )
+ bl fill
+;
diff --git a/amforth-6.5/common/lib/forth2012/core/buffer.frt b/amforth-6.5/common/lib/forth2012/core/buffer.frt
new file mode 100644
index 0000000..10db671
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/core/buffer.frt
@@ -0,0 +1,6 @@
+\ allocate a buffer and give it a name in the dictionary
+\ see http://www.forth200x.org/buffer.html
+
+: buffer: ( n "<spaces>name" )
+ \ variable already allocates 1 cell
+ variable 1 cells - allot ;
diff --git a/amforth-6.5/common/lib/forth2012/core/char-plus.frt b/amforth-6.5/common/lib/forth2012/core/char-plus.frt
new file mode 100644
index 0000000..c71230e
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/core/char-plus.frt
@@ -0,0 +1,3 @@
+\ a character has 1 bytes
+: char+ 1+ ;
+
diff --git a/amforth-6.5/common/lib/forth2012/core/chars.frt b/amforth-6.5/common/lib/forth2012/core/chars.frt
new file mode 100644
index 0000000..254b3dc
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/core/chars.frt
@@ -0,0 +1,3 @@
+\ a character has 1 byte, multiply by 1 is easy
+: chars ; immediate \ does nothing at all
+
diff --git a/amforth-6.5/common/lib/forth2012/core/count.frt b/amforth-6.5/common/lib/forth2012/core/count.frt
new file mode 100644
index 0000000..339da65
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/core/count.frt
@@ -0,0 +1,3 @@
+
+\ ( addr -- addr+1 len )
+: count dup 1+ swap c@ ;
diff --git a/amforth-6.5/common/lib/forth2012/core/dot-paren.frt b/amforth-6.5/common/lib/forth2012/core/dot-paren.frt
new file mode 100644
index 0000000..6266725
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/core/dot-paren.frt
@@ -0,0 +1,5 @@
+
+: .( \ (s -- )
+ [char] ) parse type
+; immediate
+
diff --git a/amforth-6.5/common/lib/forth2012/core/erase.frt b/amforth-6.5/common/lib/forth2012/core/erase.frt
new file mode 100644
index 0000000..eb23f3b
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/core/erase.frt
@@ -0,0 +1,6 @@
+\ fill a memory area with zeros
+
+: erase ( addr n -- )
+ 0 fill
+;
+
diff --git a/amforth-6.5/common/lib/forth2012/core/find.frt b/amforth-6.5/common/lib/forth2012/core/find.frt
new file mode 100644
index 0000000..a289cc8
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/core/find.frt
@@ -0,0 +1,21 @@
+\ #require count.frt
+
+: find ( addr -- addr 0 | xt -1 | xt 1 )
+ dup count find-xt dup
+ if rot drop then
+;
+
+\ \ find-xt is using the order stack
+\ \ with map-stack as iterator.
+\ : (find-xt) ( addr len wid -- addr len 0 | xt +/-1 -1 )
+\ >r 2dup r> search-wordlist
+\ dup if
+\ >r nip nip r> -1
+\ then
+\ ;
+\
+\ : find-xt
+\ ['] (find-xt) 'ORDER map-stack
+\ 0= if 2drop 0 then
+\ ;
+
diff --git a/amforth-6.5/common/lib/forth2012/core/is.frt b/amforth-6.5/common/lib/forth2012/core/is.frt
new file mode 100644
index 0000000..9ac18ea
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/core/is.frt
@@ -0,0 +1,12 @@
+
+\ *******************************************
+\ IS depends on defer!
+\ *******************************************
+
+: is
+ state @ if
+ postpone ['] postpone defer!
+ else
+ ' defer!
+ then
+; immediate
diff --git a/amforth-6.5/common/lib/forth2012/core/move.frt b/amforth-6.5/common/lib/forth2012/core/move.frt
new file mode 100644
index 0000000..795a8ef
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/core/move.frt
@@ -0,0 +1,5 @@
+\ respect overlapping memory regions a choose
+\ the proper cmove
+: move
+ >r 2dup u< if r> cmove> else r> cmove then
+;
diff --git a/amforth-6.5/common/lib/forth2012/core/source-id.frt b/amforth-6.5/common/lib/forth2012/core/source-id.frt
new file mode 100644
index 0000000..aeea963
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/core/source-id.frt
@@ -0,0 +1,5 @@
+
+\ source-id is currently not used
+: source-id ( -- f )
+ 0 \ always user input device
+;
diff --git a/amforth-6.5/common/lib/forth2012/core/star-slash.frt b/amforth-6.5/common/lib/forth2012/core/star-slash.frt
new file mode 100644
index 0000000..4a47ed9
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/core/star-slash.frt
@@ -0,0 +1,4 @@
+
+\ #require star-slash-mod.frt
+
+: */ */mod nip ;
diff --git a/amforth-6.5/common/lib/forth2012/core/values.frt b/amforth-6.5/common/lib/forth2012/core/values.frt
new file mode 100644
index 0000000..08bf0a1
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/core/values.frt
@@ -0,0 +1,16 @@
+
+: Uvalue ( n offs -- )
+ (value)
+ dup ,
+ ['] Udefer@ ,
+ ['] Udefer! ,
+ up@ + !
+;
+
+: Rvalue ( n -- )
+ (value)
+ here ,
+ ['] Rdefer@ ,
+ ['] Rdefer! ,
+ here ! 2 allot
+;
diff --git a/amforth-6.5/common/lib/forth2012/double.frt b/amforth-6.5/common/lib/forth2012/double.frt
new file mode 100644
index 0000000..5cd2e14
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/double.frt
@@ -0,0 +1,9 @@
+\ 'double.frt' generated automatically, do not edit
+#include 2constant.frt
+#include 2-fetch.frt
+#include 2nip.frt
+#include 2rot.frt
+#include 2tuck.frt
+#include 2-store.frt
+#include 2variable.frt
+#include m-star-slash.frt
diff --git a/amforth-6.5/common/lib/forth2012/double/2-fetch.frt b/amforth-6.5/common/lib/forth2012/double/2-fetch.frt
new file mode 100644
index 0000000..9b3a76a
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/double/2-fetch.frt
@@ -0,0 +1,7 @@
+\ 2@ ( addr -- n1 n2 )
+: 2@
+ dup ( -- addr addr )
+ cell+ ( -- addr addr+2 )
+ @ ( -- addr n2 )
+ swap ( -- n2 addr )
+ @ ; ( -- n2 n1 )
diff --git a/amforth-6.5/common/lib/forth2012/double/2-store.frt b/amforth-6.5/common/lib/forth2012/double/2-store.frt
new file mode 100644
index 0000000..93d2402
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/double/2-store.frt
@@ -0,0 +1,7 @@
+\ 2! ( n1 n2 addr -- )
+: 2!
+ swap ( -- n1 addr n2 )
+ over ( -- n1 addr n2 addr )
+ ! ( -- n1 addr )
+ cell+ ( -- n1 addr+2 )
+ ! ;
diff --git a/amforth-6.5/common/lib/forth2012/double/2constant.frt b/amforth-6.5/common/lib/forth2012/double/2constant.frt
new file mode 100644
index 0000000..4f012d3
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/double/2constant.frt
@@ -0,0 +1,6 @@
+
+: 2constant
+ create , ,
+ does>
+ dup 1+ @i swap @i
+;
diff --git a/amforth-6.5/common/lib/forth2012/double/2nip.frt b/amforth-6.5/common/lib/forth2012/double/2nip.frt
new file mode 100644
index 0000000..04c5599
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/double/2nip.frt
@@ -0,0 +1,4 @@
+\ 2nip ( w1 w2 w3 w4 -- w3 w4 ) gforth two_nip
+: 2nip
+ 2swap 2drop ;
+
diff --git a/amforth-6.5/common/lib/forth2012/double/2rot.frt b/amforth-6.5/common/lib/forth2012/double/2rot.frt
new file mode 100644
index 0000000..4befd64
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/double/2rot.frt
@@ -0,0 +1,3 @@
+\ 2rot ( w1 w2 w3 w4 w5 w6 -- w3 w4 w5 w6 w1 w2 ) double-ext two_rote
+: 2rot
+ >r >r 2swap r> r> 2swap ;
diff --git a/amforth-6.5/common/lib/forth2012/double/2tuck.frt b/amforth-6.5/common/lib/forth2012/double/2tuck.frt
new file mode 100644
index 0000000..9ad9781
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/double/2tuck.frt
@@ -0,0 +1,3 @@
+\ 2tuck ( w1 w2 w3 w4 -- w3 w4 w1 w2 w3 w4 ) gforth two_tuck
+: 2tuck
+ 2swap 2over ;
diff --git a/amforth-6.5/common/lib/forth2012/double/2variable.frt b/amforth-6.5/common/lib/forth2012/double/2variable.frt
new file mode 100644
index 0000000..f6b63fb
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/double/2variable.frt
@@ -0,0 +1,4 @@
+
+: 2variable
+ here 2 cells allot constant
+;
diff --git a/amforth-6.5/common/lib/forth2012/double/d-equal.frt b/amforth-6.5/common/lib/forth2012/double/d-equal.frt
new file mode 100644
index 0000000..db5a9c6
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/double/d-equal.frt
@@ -0,0 +1,2 @@
+ ( d1 d2 -- f )
+: d= d- or 0= ;
diff --git a/amforth-6.5/common/lib/forth2012/double/d-greater-zero.frt b/amforth-6.5/common/lib/forth2012/double/d-greater-zero.frt
new file mode 100644
index 0000000..3628320
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/double/d-greater-zero.frt
@@ -0,0 +1,8 @@
+
+\ #require d-less-zero.frt
+
+: d0> ( d -- f)
+ 2dup or >r \ not equal zero
+ d0< 0= r> and \ and not less zero
+ 0= 0= \ normalize to 0/-1 flag
+;
diff --git a/amforth-6.5/common/lib/forth2012/double/d-greater.frt b/amforth-6.5/common/lib/forth2012/double/d-greater.frt
new file mode 100644
index 0000000..133cdcd
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/double/d-greater.frt
@@ -0,0 +1,3 @@
+
+( d1 d2 -- f )
+: d> d- d0> ;
diff --git a/amforth-6.5/common/lib/forth2012/double/d-less-zero.frt b/amforth-6.5/common/lib/forth2012/double/d-less-zero.frt
new file mode 100644
index 0000000..973b9da
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/double/d-less-zero.frt
@@ -0,0 +1,2 @@
+
+: d0< nip 0< ;
diff --git a/amforth-6.5/common/lib/forth2012/double/d-less.frt b/amforth-6.5/common/lib/forth2012/double/d-less.frt
new file mode 100644
index 0000000..b85cbb8
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/double/d-less.frt
@@ -0,0 +1,5 @@
+
+\ #require d-less-zero.frt
+
+( d1 d2 -- f )
+: d< d- d0< ;
diff --git a/amforth-6.5/common/lib/forth2012/double/d-max.frt b/amforth-6.5/common/lib/forth2012/double/d-max.frt
new file mode 100644
index 0000000..fcf979a
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/double/d-max.frt
@@ -0,0 +1,3 @@
+
+: dmax ( d1 d2 -- d ) \ double d-max
+ 2over 2over d< if 2swap then 2drop ;
diff --git a/amforth-6.5/common/lib/forth2012/double/d-min.frt b/amforth-6.5/common/lib/forth2012/double/d-min.frt
new file mode 100644
index 0000000..beca796
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/double/d-min.frt
@@ -0,0 +1,2 @@
+: dmin ( d1 d2 -- d ) \ double d-min
+ 2over 2over d> if 2swap then 2drop ;
diff --git a/amforth-6.5/common/lib/forth2012/double/d-plusstore.frt b/amforth-6.5/common/lib/forth2012/double/d-plusstore.frt
new file mode 100644
index 0000000..c7405b5
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/double/d-plusstore.frt
@@ -0,0 +1,4 @@
+
+: d+! ( d addr -- ) \ same as +! but for double cell numbers
+ dup >r 2@ d+ r> 2!
+;
diff --git a/amforth-6.5/common/lib/forth2012/double/d-zero-equal.frt b/amforth-6.5/common/lib/forth2012/double/d-zero-equal.frt
new file mode 100644
index 0000000..a853671
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/double/d-zero-equal.frt
@@ -0,0 +1,3 @@
+
+( d -- f )
+: d0= or 0= ;
diff --git a/amforth-6.5/common/lib/forth2012/double/m-plus.frt b/amforth-6.5/common/lib/forth2012/double/m-plus.frt
new file mode 100644
index 0000000..f716566
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/double/m-plus.frt
@@ -0,0 +1,2 @@
+
+: m+ s>d d+ ;
diff --git a/amforth-6.5/common/lib/forth2012/double/m-star-slash.frt b/amforth-6.5/common/lib/forth2012/double/m-star-slash.frt
new file mode 100644
index 0000000..94959d4
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/double/m-star-slash.frt
@@ -0,0 +1,7 @@
+
+: m*/ ( d1 n2 u3 -- dquot ) \ double m-star-slash
+ >r s>d >r abs rot rot
+ s>d r> xor r> swap >r >r dabs rot tuck um* 2swap um*
+ swap >r 0 d+ r> rot rot r@ um/mod rot rot r> um/mod
+ nip swap r> if dnegate then
+;
diff --git a/amforth-6.5/common/lib/forth2012/facility.frt b/amforth-6.5/common/lib/forth2012/facility.frt
new file mode 100644
index 0000000..1be4601
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/facility.frt
@@ -0,0 +1,3 @@
+\ 'facility.frt' generated automatically, do not edit
+#include ms.frt
+#include time-and-date.frt
diff --git a/amforth-6.5/common/lib/forth2012/facility/ms.frt b/amforth-6.5/common/lib/forth2012/facility/ms.frt
new file mode 100644
index 0000000..7dfcd5d
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/facility/ms.frt
@@ -0,0 +1,3 @@
+
+\ a trivial multitasking friendly ms
+: ms 0 ?do pause 1ms loop ;
diff --git a/amforth-6.5/common/lib/forth2012/facility/structures-array.frt b/amforth-6.5/common/lib/forth2012/facility/structures-array.frt
new file mode 100644
index 0000000..14e62df
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/facility/structures-array.frt
@@ -0,0 +1,24 @@
+
+begin-structure hash
+ field: hash.key
+ field: hash.value
+end-structure
+
+\ inspired by CELLS
+: hash-cells hash * ;
+
+\ define a hash-array
+: hash:
+ hash-cells buffer:
+ does>
+ swap hash-cells +
+;
+
+\ define an array of some elements hash'es
+4 hash: my-hash
+cr 0 my-hash .
+cr 1 my-hash .
+
+\ store a key/value pair
+42 3 my-hash hash.key !
+4711 3 my-hash hash.value !
diff --git a/amforth-6.5/common/lib/forth2012/facility/structures-test.frt b/amforth-6.5/common/lib/forth2012/facility/structures-test.frt
new file mode 100644
index 0000000..c4e810c
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/facility/structures-test.frt
@@ -0,0 +1,16 @@
+\ simple test example for forth200x structures
+\ define a new data structure named list.
+
+begin-structure list
+ field: l.p \ previous
+ field: l.n \ next
+ field: l.d \ data
+end-structure
+
+\ create an instance of the datastructure list
+\ named listroot
+
+list buffer: listroot
+
+\ access an element from the instance
+$55aa listroot l.d !
diff --git a/amforth-6.5/common/lib/forth2012/facility/structures.frt b/amforth-6.5/common/lib/forth2012/facility/structures.frt
new file mode 100644
index 0000000..65f8e5e
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/facility/structures.frt
@@ -0,0 +1,24 @@
+\ structures according to http://www.forth200x.org/structures.html
+\ and http://www.forth200x.org/structures2.html
+\ the reference implementation does not work since amforth uses
+\ not the unified memory model for dictionary and data
+
+: +field: ( n1 "<spaces>name" -- n2 )
+ create over , +
+ does> @i +
+;
+
+: begin-structure
+ create dp 0 -1 , \ -1 saves a flash erase when end-structure is executed
+ does>
+ @i
+;
+
+: end-structure
+ swap !i
+;
+
+: cfield: 1 +field: ;
+: field: 2 +field: ;
+\ 2field is not standard, but why not?
+: 2field: 4 +field: ;
diff --git a/amforth-6.5/common/lib/forth2012/facility/time-and-date.frt b/amforth-6.5/common/lib/forth2012/facility/time-and-date.frt
new file mode 100644
index 0000000..aecbeff
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/facility/time-and-date.frt
@@ -0,0 +1,33 @@
+
+
+\ common words for date&time
+
+\ uses timer interrrupt module to call
+\ a background task every second.
+
+\ holds the ever increasing time ticks
+\ unfortunatly, a day has more seconds
+\ a 16bit variable can store.
+2variable time \ the seconds of the current day
+2variable date \ a day number
+
+\ a background task
+: next-second
+ time 2@ 1. d+ 2dup
+ 86399. d> if
+ 2drop 0.
+ 1. date d+!
+ then
+ time 2!
+;
+
+: dateinit
+ 0. time 2!
+ 0. date 2!
+;
+
+\ simple world. Every month has 30 days
+: time&date ( -- sec min hour day month year )
+ date 2@ 365 um/mod 30 /mod ( -- day month year )
+ time 2@ 24 um/mod 60 /mod ( -- sec min hour )
+;
diff --git a/amforth-6.5/common/lib/forth2012/file/paren.frt b/amforth-6.5/common/lib/forth2012/file/paren.frt
new file mode 100644
index 0000000..24c8460
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/file/paren.frt
@@ -0,0 +1,11 @@
+\ redefine (, still buggy
+: (
+ begin
+ >in @ [char] ) parse nip
+ >in @ rot - = \ something found?
+ while
+ refill 0=
+ if
+ abort" refill while searching ) failed"
+ then
+ repeat ; immediate
diff --git a/amforth-6.5/common/lib/forth2012/memory.frt b/amforth-6.5/common/lib/forth2012/memory.frt
new file mode 100644
index 0000000..82debbf
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/memory.frt
@@ -0,0 +1,2 @@
+\ 'memory.frt' generated automatically, do not edit
+#include memory.frt
diff --git a/amforth-6.5/common/lib/forth2012/search-order.frt b/amforth-6.5/common/lib/forth2012/search-order.frt
new file mode 100644
index 0000000..db7f92a
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/search-order.frt
@@ -0,0 +1,10 @@
+\ include words from the search order wordset
+
+\ from search order
+\ #require set-order.frt
+\ #require get-order.frt
+\ #require also.frt
+\ #require definitions.frt
+\ #require forth.frt
+\ #require previous.frt
+\ #require order.frt
diff --git a/amforth-6.5/common/lib/forth2012/search/also.frt b/amforth-6.5/common/lib/forth2012/search/also.frt
new file mode 100644
index 0000000..8934ce4
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/search/also.frt
@@ -0,0 +1,8 @@
+\ duplicate first wordlist entry
+
+\ #require get-order.frt
+\ #require set-order.frt
+
+: also ( -- )
+ get-order over swap 1+ set-order
+;
diff --git a/amforth-6.5/common/lib/forth2012/search/definitions.frt b/amforth-6.5/common/lib/forth2012/search/definitions.frt
new file mode 100644
index 0000000..7ab89f0
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/search/definitions.frt
@@ -0,0 +1,8 @@
+\ Make the compilation word list the same as the current first word list in the search order.
+
+\ #require get-order.frt
+
+: definitions ( -- )
+ get-order over set-current
+ 0 ?do drop loop \ clean up
+;
diff --git a/amforth-6.5/common/lib/forth2012/search/forth.frt b/amforth-6.5/common/lib/forth2012/search/forth.frt
new file mode 100644
index 0000000..77d6e6f
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/search/forth.frt
@@ -0,0 +1,10 @@
+\ replace the first search order entry
+\ with forth-wordlist
+
+\ #require get-order.frt
+\ #require set-order.frt
+
+: forth
+ get-order nip
+ forth-wordlist swap set-order
+;
diff --git a/amforth-6.5/common/lib/forth2012/search/get-order.frt b/amforth-6.5/common/lib/forth2012/search/get-order.frt
new file mode 100644
index 0000000..958df7a
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/search/get-order.frt
@@ -0,0 +1,5 @@
+\ get the ORDER stack
+
+: get-order
+ cfg-order get-stack
+; \ No newline at end of file
diff --git a/amforth-6.5/common/lib/forth2012/search/only.frt b/amforth-6.5/common/lib/forth2012/search/only.frt
new file mode 100644
index 0000000..11d1a22
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/search/only.frt
@@ -0,0 +1,7 @@
+\ sets the system specific forth wordlist
+
+\ #require set-order.frt
+
+: only
+ forth-wordlist 1 set-order
+;
diff --git a/amforth-6.5/common/lib/forth2012/search/order.frt b/amforth-6.5/common/lib/forth2012/search/order.frt
new file mode 100644
index 0000000..b0c4057
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/search/order.frt
@@ -0,0 +1,9 @@
+\ print the wids of the current word list and the search order
+
+\ #require get-order.frt
+
+: order ( -- )
+ get-current u. cr
+ get-order dup u.
+ 0 ?do u. space loop
+;
diff --git a/amforth-6.5/common/lib/forth2012/search/previous.frt b/amforth-6.5/common/lib/forth2012/search/previous.frt
new file mode 100644
index 0000000..8d78394
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/search/previous.frt
@@ -0,0 +1,8 @@
+\ remove the first entry in the search order list
+
+\ #require get-order.frt
+\ #require set-order.frt
+
+: previous
+ get-order nip 1- set-order
+;
diff --git a/amforth-6.5/common/lib/forth2012/search/set-order.frt b/amforth-6.5/common/lib/forth2012/search/set-order.frt
new file mode 100644
index 0000000..5969ea3
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/search/set-order.frt
@@ -0,0 +1,13 @@
+\ set a new ORDER stack
+
+: set-order
+ dup 0= if -50 throw then \ no empty search order stack
+ cfg-order set-stack
+;
+
+\ A better check would be
+\ : set-order
+\ dup 0 [ s" wordlists" environment search-wordlist drop execute ] literal
+\ within if cfg-order set-stack else -50 throw then
+\ ;
+\ \ No newline at end of file
diff --git a/amforth-6.5/common/lib/forth2012/string/search.frt b/amforth-6.5/common/lib/forth2012/string/search.frt
new file mode 100644
index 0000000..36c0339
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/string/search.frt
@@ -0,0 +1,23 @@
+
+\ mostly from gforth. Minor modifications however..
+
+: str= ( c-addr1 u1 c-addr2 u2 -- f ) \ gforth
+ compare 0= ;
+
+: string-prefix? ( c-addr1 u1 c-addr2 u2 -- f ) \ gforth
+ \ Is c-addr2 u2 a prefix of c-addr1 u1 ?
+ tuck 2>r min 2r> str= ;
+
+: >= < 0= ;
+
+: search ( c-addr1 u1 c-addr2 u2 -- c-addr3 u3 flag ) \ string
+ 2>r 2dup
+ begin
+ dup r@ >= \ 2r@ nip >=
+ while
+ 2dup 2r@ string-prefix? if
+ 2swap 2drop 2r> 2drop true exit
+ then
+ 1 /string
+ repeat
+ 2drop 2r> 2drop 0 ;
diff --git a/amforth-6.5/common/lib/forth2012/string/split.frt b/amforth-6.5/common/lib/forth2012/string/split.frt
new file mode 100644
index 0000000..c627ed3
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/string/split.frt
@@ -0,0 +1,15 @@
+\ Newsgroups: comp.lang.forth
+\ Date: Sat, 21 Jun 2014 13:48:57 -0700 (PDT)
+\ From: Julian Fondren <julian....@gmail.com>
+\ slightly modified for amforth (rdrop, false)
+
+\ split a string at the first occurance
+
+\ #require 2over.frt
+\ #require search.frt
+
+: split ( 'string' 'separator' -- 'before' 'after' -1 | 0 )
+ dup >r 2over 2swap search 0= if 2drop 2drop r> drop 0 exit then
+ 2>r r@ - 2r> r> /string true
+;
+
diff --git a/amforth-6.5/common/lib/forth2012/string/trailing.frt b/amforth-6.5/common/lib/forth2012/string/trailing.frt
new file mode 100644
index 0000000..51e709d
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/string/trailing.frt
@@ -0,0 +1,10 @@
+
+
+: -trailing ( c_addr u1 -- c_addr u2 ) \ string dash-trailing
+\ Adjust the string specified by {c-addr, u1} to remove all
+\ trailing spaces. {u2} is the length of the modified string.
+ begin
+ dup
+ while
+ 1- 2dup + c@ bl <>
+ until 1+ then ;
diff --git a/amforth-6.5/common/lib/forth2012/tester.frt b/amforth-6.5/common/lib/forth2012/tester.frt
new file mode 100644
index 0000000..cb73a41
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/tester.frt
@@ -0,0 +1,6 @@
+\ 'tester.frt' generated automatically, do not edit
+#include anstests.zip
+#include core.fr
+#include doubletest.fth
+#include searchordertest.txt
+#include tester-amforth.frt
diff --git a/amforth-6.5/common/lib/forth2012/tester/anstests.zip b/amforth-6.5/common/lib/forth2012/tester/anstests.zip
new file mode 100644
index 0000000..34dc1bd
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/tester/anstests.zip
Binary files differ
diff --git a/amforth-6.5/common/lib/forth2012/tester/anstests0.9.zip b/amforth-6.5/common/lib/forth2012/tester/anstests0.9.zip
new file mode 100644
index 0000000..89ad461
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/tester/anstests0.9.zip
Binary files differ
diff --git a/amforth-6.5/common/lib/forth2012/tester/core.fr b/amforth-6.5/common/lib/forth2012/tester/core.fr
new file mode 100644
index 0000000..488db2a
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/tester/core.fr
@@ -0,0 +1,1002 @@
+\ From: John Hayes S1I
+\ Subject: core.fr
+\ Date: Mon, 27 Nov 95 13:10
+
+\ (C) 1995 JOHNS HOPKINS UNIVERSITY / APPLIED PHYSICS LABORATORY
+\ MAY BE DISTRIBUTED FREELY AS LONG AS THIS COPYRIGHT NOTICE REMAINS.
+\ VERSION 1.2
+\ THIS PROGRAM TESTS THE CORE WORDS OF AN ANS FORTH SYSTEM.
+\ THE PROGRAM ASSUMES A TWO'S COMPLEMENT IMPLEMENTATION WHERE
+\ THE RANGE OF SIGNED NUMBERS IS -2^(N-1) ... 2^(N-1)-1 AND
+\ THE RANGE OF UNSIGNED NUMBERS IS 0 ... 2^(N)-1.
+\ I HAVEN'T FIGURED OUT HOW TO TEST KEY, QUIT, ABORT, OR ABORT"...
+\ I ALSO HAVEN'T THOUGHT OF A WAY TO TEST ENVIRONMENT?...
+
+CR
+TESTING CORE WORDS
+HEX
+
+\ ------------------------------------------------------------------------
+TESTING BASIC ASSUMPTIONS
+
+T{ -> }T \ START WITH CLEAN SLATE
+( TEST IF ANY BITS ARE SET; ANSWER IN BASE 1 )
+T{ : BITSSET? IF 0 0 ELSE 0 THEN ; -> }T
+T{ 0 BITSSET? -> 0 }T ( ZERO IS ALL BITS CLEAR )
+T{ 1 BITSSET? -> 0 0 }T ( OTHER NUMBER HAVE AT LEAST ONE BIT )
+T{ -1 BITSSET? -> 0 0 }T
+
+\ ------------------------------------------------------------------------
+TESTING BOOLEANS: INVERT AND OR XOR
+
+T{ 0 0 AND -> 0 }T
+T{ 0 1 AND -> 0 }T
+T{ 1 0 AND -> 0 }T
+T{ 1 1 AND -> 1 }T
+
+T{ 0 INVERT 1 AND -> 1 }T
+T{ 1 INVERT 1 AND -> 0 }T
+
+0 CONSTANT 0S
+0 INVERT CONSTANT 1S
+
+T{ 0S INVERT -> 1S }T
+T{ 1S INVERT -> 0S }T
+
+T{ 0S 0S AND -> 0S }T
+T{ 0S 1S AND -> 0S }T
+T{ 1S 0S AND -> 0S }T
+T{ 1S 1S AND -> 1S }T
+
+T{ 0S 0S OR -> 0S }T
+T{ 0S 1S OR -> 1S }T
+T{ 1S 0S OR -> 1S }T
+T{ 1S 1S OR -> 1S }T
+
+T{ 0S 0S XOR -> 0S }T
+T{ 0S 1S XOR -> 1S }T
+T{ 1S 0S XOR -> 1S }T
+T{ 1S 1S XOR -> 0S }T
+
+\ ------------------------------------------------------------------------
+TESTING 2* 2/ LSHIFT RSHIFT
+
+( WE TRUST 1S, INVERT, AND BITSSET?; WE WILL CONFIRM RSHIFT LATER )
+1S 1 RSHIFT INVERT CONSTANT MSB
+T{ MSB BITSSET? -> 0 0 }T
+
+T{ 0S 2* -> 0S }T
+T{ 1 2* -> 2 }T
+T{ 4000 2* -> 8000 }T
+T{ 1S 2* 1 XOR -> 1S }T
+T{ MSB 2* -> 0S }T
+
+T{ 0S 2/ -> 0S }T
+T{ 1 2/ -> 0 }T
+T{ 4000 2/ -> 2000 }T
+T{ 1S 2/ -> 1S }T \ MSB PROPOGATED
+T{ 1S 1 XOR 2/ -> 1S }T
+T{ MSB 2/ MSB AND -> MSB }T
+
+T{ 1 0 LSHIFT -> 1 }T
+T{ 1 1 LSHIFT -> 2 }T
+T{ 1 2 LSHIFT -> 4 }T
+T{ 1 F LSHIFT -> 8000 }T \ BIGGEST GUARANTEED SHIFT
+T{ 1S 1 LSHIFT 1 XOR -> 1S }T
+T{ MSB 1 LSHIFT -> 0 }T
+
+T{ 1 0 RSHIFT -> 1 }T
+T{ 1 1 RSHIFT -> 0 }T
+T{ 2 1 RSHIFT -> 1 }T
+T{ 4 2 RSHIFT -> 1 }T
+T{ 8000 F RSHIFT -> 1 }T \ BIGGEST
+T{ MSB 1 RSHIFT MSB AND -> 0 }T \ RSHIFT ZERO FILLS MSBS
+T{ MSB 1 RSHIFT 2* -> MSB }T
+
+\ ------------------------------------------------------------------------
+TESTING COMPARISONS: 0= = 0< < > U< MIN MAX
+0 INVERT CONSTANT MAX-UINT
+0 INVERT 1 RSHIFT CONSTANT MAX-INT
+0 INVERT 1 RSHIFT INVERT CONSTANT MIN-INT
+0 INVERT 1 RSHIFT CONSTANT MID-UINT
+0 INVERT 1 RSHIFT INVERT CONSTANT MID-UINT+1
+
+0S CONSTANT <FALSE>
+1S CONSTANT <TRUE>
+
+T{ 0 0= -> <TRUE> }T
+T{ 1 0= -> <FALSE> }T
+T{ 2 0= -> <FALSE> }T
+T{ -1 0= -> <FALSE> }T
+T{ MAX-UINT 0= -> <FALSE> }T
+T{ MIN-INT 0= -> <FALSE> }T
+T{ MAX-INT 0= -> <FALSE> }T
+
+T{ 0 0 = -> <TRUE> }T
+T{ 1 1 = -> <TRUE> }T
+T{ -1 -1 = -> <TRUE> }T
+T{ 1 0 = -> <FALSE> }T
+T{ -1 0 = -> <FALSE> }T
+T{ 0 1 = -> <FALSE> }T
+T{ 0 -1 = -> <FALSE> }T
+
+T{ 0 0< -> <FALSE> }T
+T{ -1 0< -> <TRUE> }T
+T{ MIN-INT 0< -> <TRUE> }T
+T{ 1 0< -> <FALSE> }T
+T{ MAX-INT 0< -> <FALSE> }T
+
+T{ 0 1 < -> <TRUE> }T
+T{ 1 2 < -> <TRUE> }T
+T{ -1 0 < -> <TRUE> }T
+T{ -1 1 < -> <TRUE> }T
+T{ MIN-INT 0 < -> <TRUE> }T
+T{ MIN-INT MAX-INT < -> <TRUE> }T
+T{ 0 MAX-INT < -> <TRUE> }T
+T{ 0 0 < -> <FALSE> }T
+T{ 1 1 < -> <FALSE> }T
+T{ 1 0 < -> <FALSE> }T
+T{ 2 1 < -> <FALSE> }T
+T{ 0 -1 < -> <FALSE> }T
+T{ 1 -1 < -> <FALSE> }T
+T{ 0 MIN-INT < -> <FALSE> }T
+T{ MAX-INT MIN-INT < -> <FALSE> }T
+T{ MAX-INT 0 < -> <FALSE> }T
+
+T{ 0 1 > -> <FALSE> }T
+T{ 1 2 > -> <FALSE> }T
+T{ -1 0 > -> <FALSE> }T
+T{ -1 1 > -> <FALSE> }T
+T{ MIN-INT 0 > -> <FALSE> }T
+T{ MIN-INT MAX-INT > -> <FALSE> }T
+T{ 0 MAX-INT > -> <FALSE> }T
+T{ 0 0 > -> <FALSE> }T
+T{ 1 1 > -> <FALSE> }T
+T{ 1 0 > -> <TRUE> }T
+T{ 2 1 > -> <TRUE> }T
+T{ 0 -1 > -> <TRUE> }T
+T{ 1 -1 > -> <TRUE> }T
+T{ 0 MIN-INT > -> <TRUE> }T
+T{ MAX-INT MIN-INT > -> <TRUE> }T
+T{ MAX-INT 0 > -> <TRUE> }T
+
+T{ 0 1 U< -> <TRUE> }T
+T{ 1 2 U< -> <TRUE> }T
+T{ 0 MID-UINT U< -> <TRUE> }T
+T{ 0 MAX-UINT U< -> <TRUE> }T
+T{ MID-UINT MAX-UINT U< -> <TRUE> }T
+T{ 0 0 U< -> <FALSE> }T
+T{ 1 1 U< -> <FALSE> }T
+T{ 1 0 U< -> <FALSE> }T
+T{ 2 1 U< -> <FALSE> }T
+T{ MID-UINT 0 U< -> <FALSE> }T
+T{ MAX-UINT 0 U< -> <FALSE> }T
+T{ MAX-UINT MID-UINT U< -> <FALSE> }T
+
+T{ 0 1 MIN -> 0 }T
+T{ 1 2 MIN -> 1 }T
+T{ -1 0 MIN -> -1 }T
+T{ -1 1 MIN -> -1 }T
+T{ MIN-INT 0 MIN -> MIN-INT }T
+T{ MIN-INT MAX-INT MIN -> MIN-INT }T
+T{ 0 MAX-INT MIN -> 0 }T
+T{ 0 0 MIN -> 0 }T
+T{ 1 1 MIN -> 1 }T
+T{ 1 0 MIN -> 0 }T
+T{ 2 1 MIN -> 1 }T
+T{ 0 -1 MIN -> -1 }T
+T{ 1 -1 MIN -> -1 }T
+T{ 0 MIN-INT MIN -> MIN-INT }T
+T{ MAX-INT MIN-INT MIN -> MIN-INT }T
+T{ MAX-INT 0 MIN -> 0 }T
+
+T{ 0 1 MAX -> 1 }T
+T{ 1 2 MAX -> 2 }T
+T{ -1 0 MAX -> 0 }T
+T{ -1 1 MAX -> 1 }T
+T{ MIN-INT 0 MAX -> 0 }T
+T{ MIN-INT MAX-INT MAX -> MAX-INT }T
+T{ 0 MAX-INT MAX -> MAX-INT }T
+T{ 0 0 MAX -> 0 }T
+T{ 1 1 MAX -> 1 }T
+T{ 1 0 MAX -> 1 }T
+T{ 2 1 MAX -> 2 }T
+T{ 0 -1 MAX -> 0 }T
+T{ 1 -1 MAX -> 1 }T
+T{ 0 MIN-INT MAX -> 0 }T
+T{ MAX-INT MIN-INT MAX -> MAX-INT }T
+T{ MAX-INT 0 MAX -> MAX-INT }T
+
+\ ------------------------------------------------------------------------
+TESTING STACK OPS: 2DROP 2DUP 2OVER 2SWAP ?DUP DEPTH DROP DUP OVER ROT SWAP
+
+T{ 1 2 2DROP -> }T
+T{ 1 2 2DUP -> 1 2 1 2 }T
+T{ 1 2 3 4 2OVER -> 1 2 3 4 1 2 }T
+T{ 1 2 3 4 2SWAP -> 3 4 1 2 }T
+T{ 0 ?DUP -> 0 }T
+T{ 1 ?DUP -> 1 1 }T
+T{ -1 ?DUP -> -1 -1 }T
+T{ DEPTH -> 0 }T
+T{ 0 DEPTH -> 0 1 }T
+T{ 0 1 DEPTH -> 0 1 2 }T
+T{ 0 DROP -> }T
+T{ 1 2 DROP -> 1 }T
+T{ 1 DUP -> 1 1 }T
+T{ 1 2 OVER -> 1 2 1 }T
+T{ 1 2 3 ROT -> 2 3 1 }T
+T{ 1 2 SWAP -> 2 1 }T
+
+\ ------------------------------------------------------------------------
+TESTING >R R> R@
+
+T{ : GR1 >R R> ; -> }T
+T{ : GR2 >R R@ R> DROP ; -> }T
+T{ 123 GR1 -> 123 }T
+T{ 123 GR2 -> 123 }T
+T{ 1S GR1 -> 1S }T ( RETURN STACK HOLDS CELLS )
+
+\ ------------------------------------------------------------------------
+TESTING ADD/SUBTRACT: + - 1+ 1- ABS NEGATE
+
+T{ 0 5 + -> 5 }T
+T{ 5 0 + -> 5 }T
+T{ 0 -5 + -> -5 }T
+T{ -5 0 + -> -5 }T
+T{ 1 2 + -> 3 }T
+T{ 1 -2 + -> -1 }T
+T{ -1 2 + -> 1 }T
+T{ -1 -2 + -> -3 }T
+T{ -1 1 + -> 0 }T
+T{ MID-UINT 1 + -> MID-UINT+1 }T
+
+T{ 0 5 - -> -5 }T
+T{ 5 0 - -> 5 }T
+T{ 0 -5 - -> 5 }T
+T{ -5 0 - -> -5 }T
+T{ 1 2 - -> -1 }T
+T{ 1 -2 - -> 3 }T
+T{ -1 2 - -> -3 }T
+T{ -1 -2 - -> 1 }T
+T{ 0 1 - -> -1 }T
+T{ MID-UINT+1 1 - -> MID-UINT }T
+
+T{ 0 1+ -> 1 }T
+T{ -1 1+ -> 0 }T
+T{ 1 1+ -> 2 }T
+T{ MID-UINT 1+ -> MID-UINT+1 }T
+
+T{ 2 1- -> 1 }T
+T{ 1 1- -> 0 }T
+T{ 0 1- -> -1 }T
+T{ MID-UINT+1 1- -> MID-UINT }T
+
+T{ 0 NEGATE -> 0 }T
+T{ 1 NEGATE -> -1 }T
+T{ -1 NEGATE -> 1 }T
+T{ 2 NEGATE -> -2 }T
+T{ -2 NEGATE -> 2 }T
+
+T{ 0 ABS -> 0 }T
+T{ 1 ABS -> 1 }T
+T{ -1 ABS -> 1 }T
+T{ MIN-INT ABS -> MID-UINT+1 }T
+
+\ ------------------------------------------------------------------------
+TESTING MULTIPLY: S>D * M* UM*
+
+T{ 0 S>D -> 0 0 }T
+T{ 1 S>D -> 1 0 }T
+T{ 2 S>D -> 2 0 }T
+T{ -1 S>D -> -1 -1 }T
+T{ -2 S>D -> -2 -1 }T
+T{ MIN-INT S>D -> MIN-INT -1 }T
+T{ MAX-INT S>D -> MAX-INT 0 }T
+
+T{ 0 0 M* -> 0 S>D }T
+T{ 0 1 M* -> 0 S>D }T
+T{ 1 0 M* -> 0 S>D }T
+T{ 1 2 M* -> 2 S>D }T
+T{ 2 1 M* -> 2 S>D }T
+T{ 3 3 M* -> 9 S>D }T
+T{ -3 3 M* -> -9 S>D }T
+T{ 3 -3 M* -> -9 S>D }T
+T{ -3 -3 M* -> 9 S>D }T
+T{ 0 MIN-INT M* -> 0 S>D }T
+T{ 1 MIN-INT M* -> MIN-INT S>D }T
+T{ 2 MIN-INT M* -> 0 1S }T
+T{ 0 MAX-INT M* -> 0 S>D }T
+T{ 1 MAX-INT M* -> MAX-INT S>D }T
+T{ 2 MAX-INT M* -> MAX-INT 1 LSHIFT 0 }T
+T{ MIN-INT MIN-INT M* -> 0 MSB 1 RSHIFT }T
+T{ MAX-INT MIN-INT M* -> MSB MSB 2/ }T
+T{ MAX-INT MAX-INT M* -> 1 MSB 2/ INVERT }T
+
+T{ 0 0 * -> 0 }T \ TEST IDENTITIES
+T{ 0 1 * -> 0 }T
+T{ 1 0 * -> 0 }T
+T{ 1 2 * -> 2 }T
+T{ 2 1 * -> 2 }T
+T{ 3 3 * -> 9 }T
+T{ -3 3 * -> -9 }T
+T{ 3 -3 * -> -9 }T
+T{ -3 -3 * -> 9 }T
+
+T{ MID-UINT+1 1 RSHIFT 2 * -> MID-UINT+1 }T
+T{ MID-UINT+1 2 RSHIFT 4 * -> MID-UINT+1 }T
+T{ MID-UINT+1 1 RSHIFT MID-UINT+1 OR 2 * -> MID-UINT+1 }T
+
+T{ 0 0 UM* -> 0 0 }T
+T{ 0 1 UM* -> 0 0 }T
+T{ 1 0 UM* -> 0 0 }T
+T{ 1 2 UM* -> 2 0 }T
+T{ 2 1 UM* -> 2 0 }T
+T{ 3 3 UM* -> 9 0 }T
+
+T{ MID-UINT+1 1 RSHIFT 2 UM* -> MID-UINT+1 0 }T
+T{ MID-UINT+1 2 UM* -> 0 1 }T
+T{ MID-UINT+1 4 UM* -> 0 2 }T
+T{ 1S 2 UM* -> 1S 1 LSHIFT 1 }T
+T{ MAX-UINT MAX-UINT UM* -> 1 1 INVERT }T
+
+\ ------------------------------------------------------------------------
+TESTING DIVIDE: FM/MOD SM/REM UM/MOD */ */MOD / /MOD MOD
+
+T{ 0 S>D 1 FM/MOD -> 0 0 }T
+T{ 1 S>D 1 FM/MOD -> 0 1 }T
+T{ 2 S>D 1 FM/MOD -> 0 2 }T
+T{ -1 S>D 1 FM/MOD -> 0 -1 }T
+T{ -2 S>D 1 FM/MOD -> 0 -2 }T
+T{ 0 S>D -1 FM/MOD -> 0 0 }T
+T{ 1 S>D -1 FM/MOD -> 0 -1 }T
+T{ 2 S>D -1 FM/MOD -> 0 -2 }T
+T{ -1 S>D -1 FM/MOD -> 0 1 }T
+T{ -2 S>D -1 FM/MOD -> 0 2 }T
+T{ 2 S>D 2 FM/MOD -> 0 1 }T
+T{ -1 S>D -1 FM/MOD -> 0 1 }T
+T{ -2 S>D -2 FM/MOD -> 0 1 }T
+T{ 7 S>D 3 FM/MOD -> 1 2 }T
+T{ 7 S>D -3 FM/MOD -> -2 -3 }T
+T{ -7 S>D 3 FM/MOD -> 2 -3 }T
+T{ -7 S>D -3 FM/MOD -> -1 2 }T
+T{ MAX-INT S>D 1 FM/MOD -> 0 MAX-INT }T
+T{ MIN-INT S>D 1 FM/MOD -> 0 MIN-INT }T
+T{ MAX-INT S>D MAX-INT FM/MOD -> 0 1 }T
+T{ MIN-INT S>D MIN-INT FM/MOD -> 0 1 }T
+T{ 1S 1 4 FM/MOD -> 3 MAX-INT }T
+T{ 1 MIN-INT M* 1 FM/MOD -> 0 MIN-INT }T
+T{ 1 MIN-INT M* MIN-INT FM/MOD -> 0 1 }T
+T{ 2 MIN-INT M* 2 FM/MOD -> 0 MIN-INT }T
+T{ 2 MIN-INT M* MIN-INT FM/MOD -> 0 2 }T
+T{ 1 MAX-INT M* 1 FM/MOD -> 0 MAX-INT }T
+T{ 1 MAX-INT M* MAX-INT FM/MOD -> 0 1 }T
+T{ 2 MAX-INT M* 2 FM/MOD -> 0 MAX-INT }T
+T{ 2 MAX-INT M* MAX-INT FM/MOD -> 0 2 }T
+T{ MIN-INT MIN-INT M* MIN-INT FM/MOD -> 0 MIN-INT }T
+T{ MIN-INT MAX-INT M* MIN-INT FM/MOD -> 0 MAX-INT }T
+T{ MIN-INT MAX-INT M* MAX-INT FM/MOD -> 0 MIN-INT }T
+T{ MAX-INT MAX-INT M* MAX-INT FM/MOD -> 0 MAX-INT }T
+
+T{ 0 S>D 1 SM/REM -> 0 0 }T
+T{ 1 S>D 1 SM/REM -> 0 1 }T
+T{ 2 S>D 1 SM/REM -> 0 2 }T
+T{ -1 S>D 1 SM/REM -> 0 -1 }T
+T{ -2 S>D 1 SM/REM -> 0 -2 }T
+T{ 0 S>D -1 SM/REM -> 0 0 }T
+T{ 1 S>D -1 SM/REM -> 0 -1 }T
+T{ 2 S>D -1 SM/REM -> 0 -2 }T
+T{ -1 S>D -1 SM/REM -> 0 1 }T
+T{ -2 S>D -1 SM/REM -> 0 2 }T
+T{ 2 S>D 2 SM/REM -> 0 1 }T
+T{ -1 S>D -1 SM/REM -> 0 1 }T
+T{ -2 S>D -2 SM/REM -> 0 1 }T
+T{ 7 S>D 3 SM/REM -> 1 2 }T
+T{ 7 S>D -3 SM/REM -> 1 -2 }T
+T{ -7 S>D 3 SM/REM -> -1 -2 }T
+T{ -7 S>D -3 SM/REM -> -1 2 }T
+T{ MAX-INT S>D 1 SM/REM -> 0 MAX-INT }T
+T{ MIN-INT S>D 1 SM/REM -> 0 MIN-INT }T
+T{ MAX-INT S>D MAX-INT SM/REM -> 0 1 }T
+T{ MIN-INT S>D MIN-INT SM/REM -> 0 1 }T
+T{ 1S 1 4 SM/REM -> 3 MAX-INT }T
+T{ 2 MIN-INT M* 2 SM/REM -> 0 MIN-INT }T
+T{ 2 MIN-INT M* MIN-INT SM/REM -> 0 2 }T
+T{ 2 MAX-INT M* 2 SM/REM -> 0 MAX-INT }T
+T{ 2 MAX-INT M* MAX-INT SM/REM -> 0 2 }T
+T{ MIN-INT MIN-INT M* MIN-INT SM/REM -> 0 MIN-INT }T
+T{ MIN-INT MAX-INT M* MIN-INT SM/REM -> 0 MAX-INT }T
+T{ MIN-INT MAX-INT M* MAX-INT SM/REM -> 0 MIN-INT }T
+T{ MAX-INT MAX-INT M* MAX-INT SM/REM -> 0 MAX-INT }T
+
+T{ 0 0 1 UM/MOD -> 0 0 }T
+T{ 1 0 1 UM/MOD -> 0 1 }T
+T{ 1 0 2 UM/MOD -> 1 0 }T
+T{ 3 0 2 UM/MOD -> 1 1 }T
+T{ MAX-UINT 2 UM* 2 UM/MOD -> 0 MAX-UINT }T
+T{ MAX-UINT 2 UM* MAX-UINT UM/MOD -> 0 2 }T
+T{ MAX-UINT MAX-UINT UM* MAX-UINT UM/MOD -> 0 MAX-UINT }T
+
+: IFFLOORED
+ [ -3 2 / -2 = INVERT ] LITERAL IF POSTPONE \ THEN ;
+
+: IFSYM
+ [ -3 2 / -1 = INVERT ] LITERAL IF POSTPONE \ THEN ;
+
+\ THE SYSTEM MIGHT DO EITHER FLOORED OR SYMMETRIC DIVISION.
+\ SINCE WE HAVE ALREADY TESTED M*, FM/MOD, AND SM/REM WE CAN USE THEM IN TEST.
+
+IFFLOORED : T/MOD >R S>D R> FM/MOD ;
+IFFLOORED : T/ T/MOD SWAP DROP ;
+IFFLOORED : TMOD T/MOD DROP ;
+IFFLOORED : T*/MOD >R M* R> FM/MOD ;
+IFFLOORED : T*/ T*/MOD SWAP DROP ;
+IFSYM : T/MOD >R S>D R> SM/REM ;
+IFSYM : T/ T/MOD SWAP DROP ;
+IFSYM : TMOD T/MOD DROP ;
+IFSYM : T*/MOD >R M* R> SM/REM ;
+IFSYM : T*/ T*/MOD SWAP DROP ;
+
+T{ 0 1 /MOD -> 0 1 T/MOD }T
+T{ 1 1 /MOD -> 1 1 T/MOD }T
+T{ 2 1 /MOD -> 2 1 T/MOD }T
+T{ -1 1 /MOD -> -1 1 T/MOD }T
+T{ -2 1 /MOD -> -2 1 T/MOD }T
+T{ 0 -1 /MOD -> 0 -1 T/MOD }T
+T{ 1 -1 /MOD -> 1 -1 T/MOD }T
+T{ 2 -1 /MOD -> 2 -1 T/MOD }T
+T{ -1 -1 /MOD -> -1 -1 T/MOD }T
+T{ -2 -1 /MOD -> -2 -1 T/MOD }T
+T{ 2 2 /MOD -> 2 2 T/MOD }T
+T{ -1 -1 /MOD -> -1 -1 T/MOD }T
+T{ -2 -2 /MOD -> -2 -2 T/MOD }T
+T{ 7 3 /MOD -> 7 3 T/MOD }T
+T{ 7 -3 /MOD -> 7 -3 T/MOD }T
+T{ -7 3 /MOD -> -7 3 T/MOD }T
+T{ -7 -3 /MOD -> -7 -3 T/MOD }T
+T{ MAX-INT 1 /MOD -> MAX-INT 1 T/MOD }T
+T{ MIN-INT 1 /MOD -> MIN-INT 1 T/MOD }T
+T{ MAX-INT MAX-INT /MOD -> MAX-INT MAX-INT T/MOD }T
+T{ MIN-INT MIN-INT /MOD -> MIN-INT MIN-INT T/MOD }T
+
+T{ 0 1 / -> 0 1 T/ }T
+T{ 1 1 / -> 1 1 T/ }T
+T{ 2 1 / -> 2 1 T/ }T
+T{ -1 1 / -> -1 1 T/ }T
+T{ -2 1 / -> -2 1 T/ }T
+T{ 0 -1 / -> 0 -1 T/ }T
+T{ 1 -1 / -> 1 -1 T/ }T
+T{ 2 -1 / -> 2 -1 T/ }T
+T{ -1 -1 / -> -1 -1 T/ }T
+T{ -2 -1 / -> -2 -1 T/ }T
+T{ 2 2 / -> 2 2 T/ }T
+T{ -1 -1 / -> -1 -1 T/ }T
+T{ -2 -2 / -> -2 -2 T/ }T
+T{ 7 3 / -> 7 3 T/ }T
+T{ 7 -3 / -> 7 -3 T/ }T
+T{ -7 3 / -> -7 3 T/ }T
+T{ -7 -3 / -> -7 -3 T/ }T
+T{ MAX-INT 1 / -> MAX-INT 1 T/ }T
+T{ MIN-INT 1 / -> MIN-INT 1 T/ }T
+T{ MAX-INT MAX-INT / -> MAX-INT MAX-INT T/ }T
+T{ MIN-INT MIN-INT / -> MIN-INT MIN-INT T/ }T
+
+T{ 0 1 MOD -> 0 1 TMOD }T
+T{ 1 1 MOD -> 1 1 TMOD }T
+T{ 2 1 MOD -> 2 1 TMOD }T
+T{ -1 1 MOD -> -1 1 TMOD }T
+T{ -2 1 MOD -> -2 1 TMOD }T
+T{ 0 -1 MOD -> 0 -1 TMOD }T
+T{ 1 -1 MOD -> 1 -1 TMOD }T
+T{ 2 -1 MOD -> 2 -1 TMOD }T
+T{ -1 -1 MOD -> -1 -1 TMOD }T
+T{ -2 -1 MOD -> -2 -1 TMOD }T
+T{ 2 2 MOD -> 2 2 TMOD }T
+T{ -1 -1 MOD -> -1 -1 TMOD }T
+T{ -2 -2 MOD -> -2 -2 TMOD }T
+T{ 7 3 MOD -> 7 3 TMOD }T
+T{ 7 -3 MOD -> 7 -3 TMOD }T
+T{ -7 3 MOD -> -7 3 TMOD }T
+T{ -7 -3 MOD -> -7 -3 TMOD }T
+T{ MAX-INT 1 MOD -> MAX-INT 1 TMOD }T
+T{ MIN-INT 1 MOD -> MIN-INT 1 TMOD }T
+T{ MAX-INT MAX-INT MOD -> MAX-INT MAX-INT TMOD }T
+T{ MIN-INT MIN-INT MOD -> MIN-INT MIN-INT TMOD }T
+
+T{ 0 2 1 */ -> 0 2 1 T*/ }T
+T{ 1 2 1 */ -> 1 2 1 T*/ }T
+T{ 2 2 1 */ -> 2 2 1 T*/ }T
+T{ -1 2 1 */ -> -1 2 1 T*/ }T
+T{ -2 2 1 */ -> -2 2 1 T*/ }T
+T{ 0 2 -1 */ -> 0 2 -1 T*/ }T
+T{ 1 2 -1 */ -> 1 2 -1 T*/ }T
+T{ 2 2 -1 */ -> 2 2 -1 T*/ }T
+T{ -1 2 -1 */ -> -1 2 -1 T*/ }T
+T{ -2 2 -1 */ -> -2 2 -1 T*/ }T
+T{ 2 2 2 */ -> 2 2 2 T*/ }T
+T{ -1 2 -1 */ -> -1 2 -1 T*/ }T
+T{ -2 2 -2 */ -> -2 2 -2 T*/ }T
+T{ 7 2 3 */ -> 7 2 3 T*/ }T
+T{ 7 2 -3 */ -> 7 2 -3 T*/ }T
+T{ -7 2 3 */ -> -7 2 3 T*/ }T
+T{ -7 2 -3 */ -> -7 2 -3 T*/ }T
+T{ MAX-INT 2 MAX-INT */ -> MAX-INT 2 MAX-INT T*/ }T
+T{ MIN-INT 2 MIN-INT */ -> MIN-INT 2 MIN-INT T*/ }T
+
+T{ 0 2 1 */MOD -> 0 2 1 T*/MOD }T
+T{ 1 2 1 */MOD -> 1 2 1 T*/MOD }T
+T{ 2 2 1 */MOD -> 2 2 1 T*/MOD }T
+T{ -1 2 1 */MOD -> -1 2 1 T*/MOD }T
+T{ -2 2 1 */MOD -> -2 2 1 T*/MOD }T
+T{ 0 2 -1 */MOD -> 0 2 -1 T*/MOD }T
+T{ 1 2 -1 */MOD -> 1 2 -1 T*/MOD }T
+T{ 2 2 -1 */MOD -> 2 2 -1 T*/MOD }T
+T{ -1 2 -1 */MOD -> -1 2 -1 T*/MOD }T
+T{ -2 2 -1 */MOD -> -2 2 -1 T*/MOD }T
+T{ 2 2 2 */MOD -> 2 2 2 T*/MOD }T
+T{ -1 2 -1 */MOD -> -1 2 -1 T*/MOD }T
+T{ -2 2 -2 */MOD -> -2 2 -2 T*/MOD }T
+T{ 7 2 3 */MOD -> 7 2 3 T*/MOD }T
+T{ 7 2 -3 */MOD -> 7 2 -3 T*/MOD }T
+T{ -7 2 3 */MOD -> -7 2 3 T*/MOD }T
+T{ -7 2 -3 */MOD -> -7 2 -3 T*/MOD }T
+T{ MAX-INT 2 MAX-INT */MOD -> MAX-INT 2 MAX-INT T*/MOD }T
+T{ MIN-INT 2 MIN-INT */MOD -> MIN-INT 2 MIN-INT T*/MOD }T
+
+\ ------------------------------------------------------------------------
+TESTING HERE , @ ! CELL+ CELLS C, C@ C! CHARS 2@ 2! ALIGN ALIGNED +! ALLOT
+
+HERE 1 ALLOT
+HERE
+CONSTANT 2NDA
+CONSTANT 1STA
+T{ 1STA 2NDA U< -> <TRUE> }T \ HERE MUST GROW WITH ALLOT
+T{ 1STA 1+ -> 2NDA }T \ ... BY ONE ADDRESS UNIT
+( MISSING TEST: NEGATIVE ALLOT )
+
+HERE 1 ,
+HERE 2 ,
+CONSTANT 2ND
+CONSTANT 1ST
+T{ 1ST 2ND U< -> <TRUE> }T \ HERE MUST GROW WITH ALLOT
+T{ 1ST CELL+ -> 2ND }T \ ... BY ONE CELL
+T{ 1ST 1 CELLS + -> 2ND }T
+T{ 1ST @ 2ND @ -> 1 2 }T
+T{ 5 1ST ! -> }T
+T{ 1ST @ 2ND @ -> 5 2 }T
+T{ 6 2ND ! -> }T
+T{ 1ST @ 2ND @ -> 5 6 }T
+T{ 1ST 2@ -> 6 5 }T
+T{ 2 1 1ST 2! -> }T
+T{ 1ST 2@ -> 2 1 }T
+T{ 1S 1ST ! 1ST @ -> 1S }T \ CAN STORE CELL-WIDE VALUE
+
+HERE 1 C,
+HERE 2 C,
+CONSTANT 2NDC
+CONSTANT 1STC
+T{ 1STC 2NDC U< -> <TRUE> }T \ HERE MUST GROW WITH ALLOT
+T{ 1STC CHAR+ -> 2NDC }T \ ... BY ONE CHAR
+T{ 1STC 1 CHARS + -> 2NDC }T
+T{ 1STC C@ 2NDC C@ -> 1 2 }T
+T{ 3 1STC C! -> }T
+T{ 1STC C@ 2NDC C@ -> 3 2 }T
+T{ 4 2NDC C! -> }T
+T{ 1STC C@ 2NDC C@ -> 3 4 }T
+
+ALIGN 1 ALLOT HERE ALIGN HERE 3 CELLS ALLOT
+CONSTANT A-ADDR CONSTANT UA-ADDR
+T{ UA-ADDR ALIGNED -> A-ADDR }T
+T{ 1 A-ADDR C! A-ADDR C@ -> 1 }T
+T{ 1234 A-ADDR ! A-ADDR @ -> 1234 }T
+T{ 123 456 A-ADDR 2! A-ADDR 2@ -> 123 456 }T
+T{ 2 A-ADDR CHAR+ C! A-ADDR CHAR+ C@ -> 2 }T
+T{ 3 A-ADDR CELL+ C! A-ADDR CELL+ C@ -> 3 }T
+T{ 1234 A-ADDR CELL+ ! A-ADDR CELL+ @ -> 1234 }T
+T{ 123 456 A-ADDR CELL+ 2! A-ADDR CELL+ 2@ -> 123 456 }T
+
+: BITS ( X -- U )
+ 0 SWAP BEGIN DUP WHILE DUP MSB AND IF >R 1+ R> THEN 2* REPEAT DROP ;
+( CHARACTERS >= 1 AU, <= SIZE OF CELL, >= 8 BITS )
+T{ 1 CHARS 1 < -> <FALSE> }T
+T{ 1 CHARS 1 CELLS > -> <FALSE> }T
+( TBD: HOW TO FIND NUMBER OF BITS? )
+
+( CELLS >= 1 AU, INTEGRAL MULTIPLE OF CHAR SIZE, >= 16 BITS )
+T{ 1 CELLS 1 < -> <FALSE> }T
+T{ 1 CELLS 1 CHARS MOD -> 0 }T
+T{ 1S BITS 10 < -> <FALSE> }T
+
+T{ 0 1ST ! -> }T
+T{ 1 1ST +! -> }T
+T{ 1ST @ -> 1 }T
+T{ -1 1ST +! 1ST @ -> 0 }T
+
+\ ------------------------------------------------------------------------
+TESTING CHAR [CHAR] [ ] BL S"
+
+T{ BL -> 20 }T
+T{ CHAR X -> 58 }T
+T{ CHAR HELLO -> 48 }T
+T{ : GC1 [CHAR] X ; -> }T
+T{ : GC2 [CHAR] HELLO ; -> }T
+T{ GC1 -> 58 }T
+T{ GC2 -> 48 }T
+T{ : GC3 [ GC1 ] LITERAL ; -> }T
+T{ GC3 -> 58 }T
+T{ : GC4 S" XY" ; -> }T
+T{ GC4 SWAP DROP -> 2 }T
+T{ GC4 DROP DUP C@ SWAP CHAR+ C@ -> 58 59 }T
+
+\ ------------------------------------------------------------------------
+TESTING ' ['] FIND EXECUTE IMMEDIATE COUNT LITERAL POSTPONE STATE
+
+T{ : GT1 123 ; -> }T
+T{ ' GT1 EXECUTE -> 123 }T
+T{ : GT2 ['] GT1 ; IMMEDIATE -> }T
+T{ GT2 EXECUTE -> 123 }T
+HERE 3 C, CHAR G C, CHAR T C, CHAR 1 C, CONSTANT GT1STRING
+HERE 3 C, CHAR G C, CHAR T C, CHAR 2 C, CONSTANT GT2STRING
+T{ GT1STRING FIND -> ' GT1 -1 }T
+T{ GT2STRING FIND -> ' GT2 1 }T
+( HOW TO SEARCH FOR NON-EXISTENT WORD? )
+\ T{ : GT3 GT2 LITERAL ; -> }T
+\ T{ GT3 -> ' GT1 }T
+\ T{ GT1STRING COUNT -> GT1STRING CHAR+ 3 }T
+
+T{ : GT4 POSTPONE GT1 ; IMMEDIATE -> }T
+T{ : GT5 GT4 ; -> }T
+T{ GT5 -> 123 }T
+T{ : GT6 345 ; IMMEDIATE -> }T
+T{ : GT7 POSTPONE GT6 ; -> }T
+T{ GT7 -> 345 }T
+
+T{ : GT8 STATE @ ; IMMEDIATE -> }T
+T{ GT8 -> 0 }T
+T{ : GT9 GT8 LITERAL ; -> }T
+T{ GT9 0= -> <FALSE> }T
+
+\ ------------------------------------------------------------------------
+TESTING IF ELSE THEN BEGIN WHILE REPEAT UNTIL RECURSE
+
+T{ : GI1 IF 123 THEN ; -> }T
+T{ : GI2 IF 123 ELSE 234 THEN ; -> }T
+T{ 0 GI1 -> }T
+T{ 1 GI1 -> 123 }T
+T{ -1 GI1 -> 123 }T
+T{ 0 GI2 -> 234 }T
+T{ 1 GI2 -> 123 }T
+T{ -1 GI1 -> 123 }T
+
+T{ : GI3 BEGIN DUP 5 < WHILE DUP 1+ REPEAT ; -> }T
+T{ 0 GI3 -> 0 1 2 3 4 5 }T
+T{ 4 GI3 -> 4 5 }T
+T{ 5 GI3 -> 5 }T
+T{ 6 GI3 -> 6 }T
+
+T{ : GI4 BEGIN DUP 1+ DUP 5 > UNTIL ; -> }T
+T{ 3 GI4 -> 3 4 5 6 }T
+T{ 5 GI4 -> 5 6 }T
+T{ 6 GI4 -> 6 7 }T
+
+T{ : GI5 BEGIN DUP 2 > WHILE DUP 5 < WHILE DUP 1+ REPEAT 123 ELSE 345 THEN ; -> }T
+T{ 1 GI5 -> 1 345 }T
+T{ 2 GI5 -> 2 345 }T
+T{ 3 GI5 -> 3 4 5 123 }T
+T{ 4 GI5 -> 4 5 123 }T
+T{ 5 GI5 -> 5 123 }T
+
+T{ : GI6 ( N -- 0,1,..N ) DUP IF DUP >R 1- RECURSE R> THEN ; -> }T
+T{ 0 GI6 -> 0 }T
+T{ 1 GI6 -> 0 1 }T
+T{ 2 GI6 -> 0 1 2 }T
+T{ 3 GI6 -> 0 1 2 3 }T
+T{ 4 GI6 -> 0 1 2 3 4 }T
+
+\ ------------------------------------------------------------------------
+TESTING DO LOOP +LOOP I J UNLOOP LEAVE EXIT
+
+T{ : GD1 DO I LOOP ; -> }T
+T{ 4 1 GD1 -> 1 2 3 }T
+T{ 2 -1 GD1 -> -1 0 1 }T
+T{ MID-UINT+1 MID-UINT GD1 -> MID-UINT }T
+
+T{ : GD2 DO I -1 +LOOP ; -> }T
+T{ 1 4 GD2 -> 4 3 2 1 }T
+T{ -1 2 GD2 -> 2 1 0 -1 }T
+T{ MID-UINT MID-UINT+1 GD2 -> MID-UINT+1 MID-UINT }T
+
+T{ : GD3 DO 1 0 DO J LOOP LOOP ; -> }T
+T{ 4 1 GD3 -> 1 2 3 }T
+T{ 2 -1 GD3 -> -1 0 1 }T
+T{ MID-UINT+1 MID-UINT GD3 -> MID-UINT }T
+
+T{ : GD4 DO 1 0 DO J LOOP -1 +LOOP ; -> }T
+T{ 1 4 GD4 -> 4 3 2 1 }T
+T{ -1 2 GD4 -> 2 1 0 -1 }T
+T{ MID-UINT MID-UINT+1 GD4 -> MID-UINT+1 MID-UINT }T
+
+T{ : GD5 123 SWAP 0 DO I 4 > IF DROP 234 LEAVE THEN LOOP ; -> }T
+T{ 1 GD5 -> 123 }T
+T{ 5 GD5 -> 123 }T
+T{ 6 GD5 -> 234 }T
+
+T{ : GD6 ( PAT: T{0 0}T,T{0 0}TT{1 0}TT{1 1}T,T{0 0}TT{1 0}TT{1 1}TT{2 0}TT{2 1}TT{2 2}T )
+ 0 SWAP 0 DO
+ I 1+ 0 DO I J + 3 = IF I UNLOOP I UNLOOP EXIT THEN 1+ LOOP
+ LOOP ; -> }T
+T{ 1 GD6 -> 1 }T
+T{ 2 GD6 -> 3 }T
+T{ 3 GD6 -> 4 1 2 }T
+
+\ ------------------------------------------------------------------------
+TESTING DEFINING WORDS: : ; CONSTANT VARIABLE CREATE DOES> >BODY
+
+T{ 123 CONSTANT X123 -> }T
+T{ X123 -> 123 }T
+T{ : EQU CONSTANT ; -> }T
+T{ X123 EQU Y123 -> }T
+T{ Y123 -> 123 }T
+
+T{ VARIABLE V1 -> }T
+T{ 123 V1 ! -> }T
+T{ V1 @ -> 123 }T
+
+T{ : NOP : POSTPONE ; ; -> }T
+T{ NOP NOP1 NOP NOP2 -> }T
+T{ NOP1 -> }T
+T{ NOP2 -> }T
+
+T{ : DOES1 DOES> @ 1 + ; -> }T
+T{ : DOES2 DOES> @ 2 + ; -> }T
+T{ CREATE CR1 -> }T
+T{ CR1 -> HERE }T
+T{ ' CR1 >BODY -> HERE }T
+T{ 1 , -> }T
+T{ CR1 @ -> 1 }T
+T{ DOES1 -> }T
+T{ CR1 -> 2 }T
+T{ DOES2 -> }T
+T{ CR1 -> 3 }T
+
+T{ : WEIRD: CREATE DOES> 1 + DOES> 2 + ; -> }T
+T{ WEIRD: W1 -> }T
+T{ ' W1 >BODY -> HERE }T
+T{ W1 -> HERE 1 + }T
+T{ W1 -> HERE 2 + }T
+
+\ ------------------------------------------------------------------------
+TESTING EVALUATE
+
+: GE1 S" 123" ; IMMEDIATE
+: GE2 S" 123 1+" ; IMMEDIATE
+: GE3 S" : GE4 345 ;" ;
+: GE5 EVALUATE ; IMMEDIATE
+
+T{ GE1 EVALUATE -> 123 }T ( TEST EVALUATE IN INTERP. STATE )
+T{ GE2 EVALUATE -> 124 }T
+T{ GE3 EVALUATE -> }T
+T{ GE4 -> 345 }T
+
+T{ : GE6 GE1 GE5 ; -> }T ( TEST EVALUATE IN COMPILE STATE )
+T{ GE6 -> 123 }T
+T{ : GE7 GE2 GE5 ; -> }T
+T{ GE7 -> 124 }T
+
+\ ------------------------------------------------------------------------
+TESTING SOURCE >IN WORD
+
+: GS1 S" SOURCE" 2DUP EVALUATE
+ >R SWAP >R = R> R> = ;
+T{ GS1 -> <TRUE> <TRUE> }T
+
+VARIABLE SCANS
+: RESCAN? -1 SCANS +! SCANS @ IF 0 >IN ! THEN ;
+
+T{ 2 SCANS !
+345 RESCAN?
+-> 345 345 }T
+
+: GS2 5 SCANS ! S" 123 RESCAN?" EVALUATE ;
+T{ GS2 -> 123 123 123 123 123 }T
+
+: GS3 WORD COUNT SWAP C@ ;
+T{ BL GS3 HELLO -> 5 CHAR H }T
+T{ CHAR " GS3 GOODBYE" -> 7 CHAR G }T
+T{ BL GS3
+DROP -> 0 }T \ BLANK LINE RETURN ZERO-LENGTH STRING
+
+: GS4 SOURCE >IN ! DROP ;
+T{ GS4 123 456
+-> }T
+
+\ ------------------------------------------------------------------------
+TESTING <# # #S #> HOLD SIGN BASE >NUMBER HEX DECIMAL
+
+: S= \ ( ADDR1 C1 ADDR2 C2 -- T/F ) COMPARE TWO STRINGS.
+ >R SWAP R@ = IF \ MAKE SURE STRINGS HAVE SAME LENGTH
+ R> ?DUP IF \ IF NON-EMPTY STRINGS
+ 0 DO
+ OVER C@ OVER C@ - IF 2DROP <FALSE> UNLOOP EXIT THEN
+ SWAP CHAR+ SWAP CHAR+
+ LOOP
+ THEN
+ 2DROP <TRUE> \ IF WE GET HERE, STRINGS MATCH
+ ELSE
+ R> DROP 2DROP <FALSE> \ LENGTHS MISMATCH
+ THEN ;
+
+: GP1 <# 41 HOLD 42 HOLD 0 0 #> S" BA" S= ;
+T{ GP1 -> <TRUE> }T
+
+: GP2 <# -1 SIGN 0 SIGN -1 SIGN 0 0 #> S" --" S= ;
+T{ GP2 -> <TRUE> }T
+
+: GP3 <# 1 0 # # #> S" 01" S= ;
+T{ GP3 -> <TRUE> }T
+
+: GP4 <# 1 0 #S #> S" 1" S= ;
+T{ GP4 -> <TRUE> }T
+
+24 CONSTANT MAX-BASE \ BASE 2 .. 36
+: COUNT-BITS
+ 0 0 INVERT BEGIN DUP WHILE >R 1+ R> 2* REPEAT DROP ;
+COUNT-BITS 2* CONSTANT #BITS-UD \ NUMBER OF BITS IN UD
+
+: GP5
+ BASE @ <TRUE>
+ MAX-BASE 1+ 2 DO \ FOR EACH POSSIBLE BASE
+ I BASE ! \ TBD: ASSUMES BASE WORKS
+ I 0 <# #S #> S" 10" S= AND
+ LOOP
+ SWAP BASE ! ;
+T{ GP5 -> <TRUE> }T
+
+: GP6
+ BASE @ >R 2 BASE !
+ MAX-UINT MAX-UINT <# #S #> \ MAXIMUM UD TO BINARY
+ R> BASE ! \ S: C-ADDR U
+ DUP #BITS-UD = SWAP
+ 0 DO \ S: C-ADDR FLAG
+ OVER C@ [CHAR] 1 = AND \ ALL ONES
+ >R CHAR+ R>
+ LOOP SWAP DROP ;
+T{ GP6 -> <TRUE> }T
+
+: GP7
+ BASE @ >R MAX-BASE BASE !
+ <TRUE>
+ A 0 DO
+ I 0 <# #S #>
+ 1 = SWAP C@ I 30 + = AND AND
+ LOOP
+ MAX-BASE A DO
+ I 0 <# #S #>
+ 1 = SWAP C@ 41 I A - + = AND AND
+ LOOP
+ R> BASE ! ;
+
+T{ GP7 -> <TRUE> }T
+
+\ >NUMBER TESTS
+CREATE GN-BUF 0 C,
+: GN-STRING GN-BUF 1 ;
+: GN-CONSUMED GN-BUF CHAR+ 0 ;
+: GN' [CHAR] ' WORD CHAR+ C@ GN-BUF C! GN-STRING ;
+
+T{ 0 0 GN' 0' >NUMBER -> 0 0 GN-CONSUMED }T
+T{ 0 0 GN' 1' >NUMBER -> 1 0 GN-CONSUMED }T
+T{ 1 0 GN' 1' >NUMBER -> BASE @ 1+ 0 GN-CONSUMED }T
+T{ 0 0 GN' -' >NUMBER -> 0 0 GN-STRING }T \ SHOULD FAIL TO CONVERT THESE
+T{ 0 0 GN' +' >NUMBER -> 0 0 GN-STRING }T
+T{ 0 0 GN' .' >NUMBER -> 0 0 GN-STRING }T
+
+: >NUMBER-BASED
+ BASE @ >R BASE ! >NUMBER R> BASE ! ;
+
+T{ 0 0 GN' 2' 10 >NUMBER-BASED -> 2 0 GN-CONSUMED }T
+T{ 0 0 GN' 2' 2 >NUMBER-BASED -> 0 0 GN-STRING }T
+T{ 0 0 GN' F' 10 >NUMBER-BASED -> F 0 GN-CONSUMED }T
+T{ 0 0 GN' G' 10 >NUMBER-BASED -> 0 0 GN-STRING }T
+T{ 0 0 GN' G' MAX-BASE >NUMBER-BASED -> 10 0 GN-CONSUMED }T
+T{ 0 0 GN' Z' MAX-BASE >NUMBER-BASED -> 23 0 GN-CONSUMED }T
+
+: GN1 \ ( UD BASE -- UD' LEN ) UD SHOULD EQUAL UD' AND LEN SHOULD BE ZERO.
+ BASE @ >R BASE !
+ <# #S #>
+ 0 0 2SWAP >NUMBER SWAP DROP \ RETURN LENGTH ONLY
+ R> BASE ! ;
+T{ 0 0 2 GN1 -> 0 0 0 }T
+T{ MAX-UINT 0 2 GN1 -> MAX-UINT 0 0 }T
+T{ MAX-UINT DUP 2 GN1 -> MAX-UINT DUP 0 }T
+T{ 0 0 MAX-BASE GN1 -> 0 0 0 }T
+T{ MAX-UINT 0 MAX-BASE GN1 -> MAX-UINT 0 0 }T
+T{ MAX-UINT DUP MAX-BASE GN1 -> MAX-UINT DUP 0 }T
+
+: GN2 \ ( -- 16 10 )
+ BASE @ >R HEX BASE @ DECIMAL BASE @ R> BASE ! ;
+T{ GN2 -> 10 A }T
+
+\ ------------------------------------------------------------------------
+TESTING FILL MOVE
+
+CREATE FBUF 00 C, 00 C, 00 C,
+CREATE SBUF 12 C, 34 C, 56 C,
+: SEEBUF FBUF C@ FBUF CHAR+ C@ FBUF CHAR+ CHAR+ C@ ;
+
+T{ FBUF 0 20 FILL -> }T
+T{ SEEBUF -> 00 00 00 }T
+
+T{ FBUF 1 20 FILL -> }T
+T{ SEEBUF -> 20 00 00 }T
+
+T{ FBUF 3 20 FILL -> }T
+T{ SEEBUF -> 20 20 20 }T
+
+T{ FBUF FBUF 3 CHARS MOVE -> }T \ BIZARRE SPECIAL CASE
+T{ SEEBUF -> 20 20 20 }T
+
+T{ SBUF FBUF 0 CHARS MOVE -> }T
+T{ SEEBUF -> 20 20 20 }T
+
+T{ SBUF FBUF 1 CHARS MOVE -> }T
+T{ SEEBUF -> 12 20 20 }T
+
+T{ SBUF FBUF 3 CHARS MOVE -> }T
+T{ SEEBUF -> 12 34 56 }T
+
+T{ FBUF FBUF CHAR+ 2 CHARS MOVE -> }T
+T{ SEEBUF -> 12 12 34 }T
+
+T{ FBUF CHAR+ FBUF 2 CHARS MOVE -> }T
+T{ SEEBUF -> 12 34 34 }T
+
+\ ------------------------------------------------------------------------
+TESTING OUTPUT: . ." CR EMIT SPACE SPACES TYPE U.
+
+: OUTPUT-TEST
+ ." YOU SHOULD SEE THE STANDARD GRAPHIC CHARACTERS:" CR
+ 41 BL DO I EMIT LOOP CR
+ 61 41 DO I EMIT LOOP CR
+ 7F 61 DO I EMIT LOOP CR
+ ." YOU SHOULD SEE 0-9 SEPARATED BY A SPACE:" CR
+ 9 1+ 0 DO I . LOOP CR
+ ." YOU SHOULD SEE 0-9 (WITH NO SPACES):" CR
+ [CHAR] 9 1+ [CHAR] 0 DO I 0 SPACES EMIT LOOP CR
+ ." YOU SHOULD SEE A-G SEPARATED BY A SPACE:" CR
+ [CHAR] G 1+ [CHAR] A DO I EMIT SPACE LOOP CR
+ ." YOU SHOULD SEE 0-5 SEPARATED BY TWO SPACES:" CR
+ 5 1+ 0 DO I [CHAR] 0 + EMIT 2 SPACES LOOP CR
+ ." YOU SHOULD SEE TWO SEPARATE LINES:" CR
+ S" LINE 1" TYPE CR S" LINE 2" TYPE CR
+ ." YOU SHOULD SEE THE NUMBER RANGES OF SIGNED AND UNSIGNED NUMBERS:" CR
+ ." SIGNED: " MIN-INT . MAX-INT . CR
+ ." UNSIGNED: " 0 U. MAX-UINT U. CR
+;
+
+T{ OUTPUT-TEST -> }T
+
+
+\ ------------------------------------------------------------------------
+TESTING INPUT: ACCEPT
+
+CREATE ABUF 80 CHARS ALLOT
+
+: ACCEPT-TEST
+ CR ." PLEASE TYPE UP TO 80 CHARACTERS:" CR
+ ABUF 80 ACCEPT
+ CR ." RECEIVED: " [CHAR] " EMIT
+ ABUF SWAP TYPE [CHAR] " EMIT CR
+;
+
+T{ ACCEPT-TEST -> }T
+
+\ ------------------------------------------------------------------------
+TESTING DICTIONARY SEARCH RULES
+
+T{ : GDX 123 ; : GDX GDX 234 ; -> }T
+
+T{ GDX -> 123 234 }T
+
+CR .( End of Core word set tests) CR
+
+
diff --git a/amforth-6.5/common/lib/forth2012/tester/coreexttest.fth b/amforth-6.5/common/lib/forth2012/tester/coreexttest.fth
new file mode 100644
index 0000000..a7de63d
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/tester/coreexttest.fth
@@ -0,0 +1,322 @@
+\ To test some of the ANS Forth Core Extension word set
+
+\ This program was written by Gerry Jackson in 2006, with contributions from
+\ others where indicated, and is in the public domain - it can be distributed
+\ and/or modified in any way but please retain this notice.
+
+\ This program is distributed in the hope that it will be useful,
+\ but WITHOUT ANY WARRANTY; without even the implied warranty of
+\ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+\ The tests are not claimed to be comprehensive or correct
+
+\ ------------------------------------------------------------------------------
+\ Version 0.6 1 April 2012 Tests placed in the public domain.
+\ SAVE-INPUT & RESTORE-INPUT tests, position
+\ of T{ moved so that tests work with ttester.fs
+\ CONVERT test deleted - obsolete word removed from Forth 200X
+\ IMMEDIATE VALUEs tested
+\ RECURSE with :NONAME tested
+\ PARSE and .( tested
+\ Parsing behaviour of C" added
+\ 0.5 14 September 2011 Removed the double [ELSE] from the
+\ initial SAVE-INPUT & RESTORE-INPUT test
+\ 0.4 30 November 2009 max-int replaced with max-intx to
+\ avoid redefinition warnings.
+\ 0.3 6 March 2009 { and } replaced with T{ and }T
+\ CONVERT test now independent of cell size
+\ 0.2 20 April 2007 ANS Forth words changed to upper case
+\ Tests qd3 to qd6 by Reinhold Straub
+\ 0.1 Oct 2006 First version released
+\ ------------------------------------------------------------------------------
+\ This is only a partial test of the core extension words.
+\ The tests are based on John Hayes test program for the core word set
+
+\ Words tested in this file are:
+\ TRUE FALSE :NONAME ?DO VALUE TO CASE OF ENDOF ENDCASE PARSE
+\ C" CONVERT COMPILE, [COMPILE] SAVE-INPUT RESTORE-INPUT .(
+\ ------------------------------------------------------------------------------
+\ Assumptions:
+\ - tester.fr or ttester.fs has been included prior to this file
+\ ------------------------------------------------------------------------------
+TESTING Core Extension words
+
+DECIMAL
+
+0 INVERT 1 RSHIFT CONSTANT max-intx \ 01...1
+
+
+TESTING TRUE FALSE
+
+T{ TRUE -> 0 INVERT }T
+T{ FALSE -> 0 }T
+
+\ ------------------------------------------------------------------------------
+TESTING :NONAME with and without RECURSEs
+
+VARIABLE nn1
+VARIABLE nn2
+:NONAME 1234 ; nn1 !
+:NONAME 9876 ; nn2 !
+T{ nn1 @ EXECUTE -> 1234 }T
+T{ nn2 @ EXECUTE -> 9876 }T
+
+T{ :NONAME ( n -- 0,1,..n ) DUP IF DUP >R 1- RECURSE R> THEN ;
+ CONSTANT rn1 -> }T
+T{ 0 rn1 EXECUTE -> 0 }T
+T{ 4 rn1 EXECUTE -> 0 1 2 3 4 }T
+
+:NONAME ( n -- n1 ) \ Multiple RECURSEs in one definition
+ 1- DUP
+ CASE 0 OF EXIT ENDOF
+ 1 OF 11 SWAP RECURSE ENDOF
+ 2 OF 22 SWAP RECURSE ENDOF
+ 3 OF 33 SWAP RECURSE ENDOF
+ DROP ABS RECURSE EXIT
+ ENDCASE
+; CONSTANT rn2
+
+T{ 1 rn2 EXECUTE -> 0 }T
+T{ 2 rn2 EXECUTE -> 11 0 }T
+T{ 4 rn2 EXECUTE -> 33 22 11 0 }T
+T{ 25 rn2 EXECUTE -> 33 22 11 0 }T
+
+\ ------------------------------------------------------------------------------
+TESTING ?DO
+
+: qd ?DO I LOOP ;
+T{ 789 789 qd -> }T
+T{ -9876 -9876 qd -> }T
+T{ 5 0 qd -> 0 1 2 3 4 }T
+
+: qd1 ?DO I 10 +LOOP ;
+T{ 50 1 qd1 -> 1 11 21 31 41 }T
+T{ 50 0 qd1 -> 0 10 20 30 40 }T
+
+: qd2 ?DO I 3 > IF LEAVE ELSE I THEN LOOP ;
+T{ 5 -1 qd2 -> -1 0 1 2 3 }T
+
+: qd3 ?DO I 1 +LOOP ;
+T{ 4 4 qd3 -> }T
+T{ 4 1 qd3 -> 1 2 3 }T
+T{ 2 -1 qd3 -> -1 0 1 }T
+
+: qd4 ?DO I -1 +LOOP ;
+T{ 4 4 qd4 -> }T
+T{ 1 4 qd4 -> 4 3 2 1 }T
+T{ -1 2 qd4 -> 2 1 0 -1 }T
+
+: qd5 ?DO I -10 +LOOP ;
+T{ 1 50 qd5 -> 50 40 30 20 10 }T
+T{ 0 50 qd5 -> 50 40 30 20 10 0 }T
+T{ -25 10 qd5 -> 10 0 -10 -20 }T
+
+VARIABLE iters
+VARIABLE incrmnt
+
+: qd6 ( limit start increment -- )
+ incrmnt !
+ 0 iters !
+ ?DO
+ 1 iters +!
+ I
+ iters @ 6 = IF LEAVE THEN
+ incrmnt @
+ +LOOP iters @
+;
+
+T{ 4 4 -1 qd6 -> 0 }T
+T{ 1 4 -1 qd6 -> 4 3 2 1 4 }T
+T{ 4 1 -1 qd6 -> 1 0 -1 -2 -3 -4 6 }T
+T{ 4 1 0 qd6 -> 1 1 1 1 1 1 6 }T
+T{ 0 0 0 qd6 -> 0 }T
+T{ 1 4 0 qd6 -> 4 4 4 4 4 4 6 }T
+T{ 1 4 1 qd6 -> 4 5 6 7 8 9 6 }T
+T{ 4 1 1 qd6 -> 1 2 3 3 }T
+T{ 4 4 1 qd6 -> 0 }T
+T{ 2 -1 -1 qd6 -> -1 -2 -3 -4 -5 -6 6 }T
+T{ -1 2 -1 qd6 -> 2 1 0 -1 4 }T
+T{ 2 -1 0 qd6 -> -1 -1 -1 -1 -1 -1 6 }T
+T{ -1 2 0 qd6 -> 2 2 2 2 2 2 6 }T
+T{ -1 2 1 qd6 -> 2 3 4 5 6 7 6 }T
+T{ 2 -1 1 qd6 -> -1 0 1 3 }T
+
+\ ------------------------------------------------------------------------------
+TESTING VALUE TO
+
+T{ 111 VALUE val1 -999 VALUE val2 -> }T
+T{ val1 -> 111 }T
+T{ val2 -> -999 }T
+T{ 222 TO val1 -> }T
+T{ val1 -> 222 }T
+T{ : vd1 val1 ; -> }T
+T{ vd1 -> 222 }T
+T{ : vd2 TO val2 ; -> }T
+T{ val2 -> -999 }T
+T{ -333 vd2 -> }T
+T{ val2 -> -333 }T
+T{ val1 -> 222 }T
+T{ 123 VALUE val3 IMMEDIATE val3 -> 123 }T
+T{ : vd3 val3 LITERAL ; vd3 -> 123 }T
+
+\ ------------------------------------------------------------------------------
+TESTING CASE OF ENDOF ENDCASE
+
+: cs1 CASE 1 OF 111 ENDOF
+ 2 OF 222 ENDOF
+ 3 OF 333 ENDOF
+ >R 999 R>
+ ENDCASE
+;
+
+T{ 1 cs1 -> 111 }T
+T{ 2 cs1 -> 222 }T
+T{ 3 cs1 -> 333 }T
+T{ 4 cs1 -> 999 }T
+
+: cs2 >R CASE -1 OF CASE R@ 1 OF 100 ENDOF
+ 2 OF 200 ENDOF
+ >R -300 R>
+ ENDCASE
+ ENDOF
+ -2 OF CASE R@ 1 OF -99 ENDOF
+ >R -199 R>
+ ENDCASE
+ ENDOF
+ >R 299 R>
+ ENDCASE R> DROP
+;
+
+T{ -1 1 cs2 -> 100 }T
+T{ -1 2 cs2 -> 200 }T
+T{ -1 3 cs2 -> -300 }T
+T{ -2 1 cs2 -> -99 }T
+T{ -2 2 cs2 -> -199 }T
+T{ 0 2 cs2 -> 299 }T
+
+\ ------------------------------------------------------------------------------
+TESTING C"
+
+T{ : cq1 C" 123" ; -> }T
+T{ cq1 COUNT EVALUATE -> 123 }T
+T{ : cq2 C" " ; -> }T
+T{ cq2 COUNT EVALUATE -> }T
+T{ : cq3 C" 2345"COUNT EVALUATE ; cq3 -> 2345 }T
+
+\ ------------------------------------------------------------------------------
+TESTING COMPILE, [COMPILE]
+
+:NONAME DUP + ; CONSTANT dup+
+T{ : q dup+ COMPILE, ; -> }T
+T{ : as1 [ q ] ; -> }T
+T{ 123 as1 -> 246 }T
+
+T{ : [c1] [COMPILE] DUP ; IMMEDIATE -> }T
+T{ 123 [c1] -> 123 123 }T \ With default compilation semantics
+T{ : [c2] [COMPILE] [c1] ; -> }T
+T{ 234 [c2] -> 234 234 }T \ With an immediate word
+T{ : [cif] [COMPILE] IF ; IMMEDIATE -> }T
+T{ : [c3] [cif] 111 ELSE 222 THEN ; -> }T \ With special compilation semantics
+T{ -1 [c3] -> 111 }T
+T{ 0 [c3] -> 222 }T
+
+\ ------------------------------------------------------------------------------
+\ Cannot automatically test SAVE-INPUT and RESTORE-INPUT from a console source
+
+TESTING SAVE-INPUT and RESTORE-INPUT with a file source
+
+VARIABLE siv -1 siv !
+
+: NeverExecuted
+ ." This should never be executed" ABORT
+;
+
+T{ 11111 SAVE-INPUT
+
+siv @
+
+[IF]
+ 0 siv !
+ RESTORE-INPUT
+ NeverExecuted
+[ELSE]
+
+TESTING the -[ELSE]- part is executed
+22222
+
+[THEN]
+
+ -> 11111 0 22222 }T \ 0 comes from RESTORE-INPUT
+
+TESTING SAVE-INPUT and RESTORE-INPUT with a string source
+
+VARIABLE si_inc 0 si_inc !
+
+: si1
+ si_inc @ >IN +!
+ 15 si_inc !
+;
+
+: s$ S" SAVE-INPUT si1 RESTORE-INPUT 12345" ;
+
+T{ s$ EVALUATE si_inc @ -> 0 2345 15 }T
+
+TESTING nested SAVE-INPUT and RESTORE-INPUT
+
+: read_a_line
+ REFILL 0=
+ ABORT" REFILL failed"
+;
+
+0 si_inc !
+
+2VARIABLE 2res -1. 2res 2!
+
+: si2
+ read_a_line
+ read_a_line
+ SAVE-INPUT
+ read_a_line
+ read_a_line
+ s$ EVALUATE 2res 2!
+ RESTORE-INPUT
+;
+
+\ WARNING: do not delete or insert lines of text after si2 is called
+\ otherwise the next test will fail
+
+T{ si2
+33333 \ This line should be ignored
+2res 2@ 44444 \ RESTORE-INPUT should return to this line
+
+55555
+TESTING the nested results
+ -> 0 0 2345 44444 55555 }T
+
+\ End of warning
+
+\ ------------------------------------------------------------------------------
+TESTING .(
+
+T{ S" A string"2DROP -> }T
+T{ CR .( You should see -9876: ) -9876 . -> }T
+T{ CR .( Repeated: ).( -9876)CR -> }T
+
+\ ------------------------------------------------------------------------------
+TESTING PARSE
+
+T{ CHAR | PARSE 1234| DUP ROT ROT EVALUATE -> 4 1234 }T
+T{ CHAR ^ PARSE 23 45 ^ DUP ROT ROT EVALUATE -> 7 23 45 }T
+: pa1 [CHAR] $ PARSE DUP >R PAD SWAP CHARS MOVE PAD R> ;
+T{ pa1 3456
+ DUP ROT ROT EVALUATE -> 4 3456 }T
+T{ CHAR a PARSE a SWAP DROP -> 0 }T
+T{ CHAR z PARSE
+ SWAP DROP -> 0 }T
+T{ CHAR " PARSE 4567 "DUP ROT ROT EVALUATE -> 5 4567 }T
+
+\ ------------------------------------------------------------------------------
+
+CR .( End of Core Extension word tests) CR
+
+
diff --git a/amforth-6.5/common/lib/forth2012/tester/coreplustest.fth b/amforth-6.5/common/lib/forth2012/tester/coreplustest.fth
new file mode 100644
index 0000000..ff165d4
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/tester/coreplustest.fth
@@ -0,0 +1,190 @@
+\ Additional tests on the the ANS Forth Core word set
+
+\ This program was written by Gerry Jackson in 2007, with contributions from
+\ others where indicated, and is in the public domain - it can be distributed
+\ and/or modified in any way but please retain this notice.
+
+\ This program is distributed in the hope that it will be useful,
+\ but WITHOUT ANY WARRANTY; without even the implied warranty of
+\ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+\ The tests are not claimed to be comprehensive or correct
+
+\ ------------------------------------------------------------------------------
+\ Version 0.3 1 April 2012 Tests placed in the public domain.
+\ Testing multiple ELSE's.
+\ Further tests on DO +LOOPs.
+\ Ackermann function added to test RECURSE.
+\ >IN manipulation in interpreter mode
+\ Immediate CONSTANTs, VARIABLEs and CREATEd words tests.
+\ :NONAME with RECURSE moved to core extension tests.
+\ Parsing behaviour of S" ." and ( tested
+\ 0.2 6 March 2009 { and } replaced with T{ and }T
+\ Added extra RECURSE tests
+\ 0.1 20 April 2007 Created
+\ ------------------------------------------------------------------------------
+\ The tests are based on John Hayes test program for the core word set
+\
+\ This file provides some more tests on Core words where the original Hayes
+\ tests are thought to be incomplete
+\
+\ Words tested in this file are:
+\ DO +LOOP RECURSE ELSE >IN IMMEDIATE
+\ ------------------------------------------------------------------------------
+\ Assumptions and dependencies:
+\ - tester.fr or ttester.fs has been loaded prior to this file
+\ - core.fr has been loaded so that constants MAX-INT, MIN-INT and
+\ MAX-UINT are defined
+\ ------------------------------------------------------------------------------
+
+DECIMAL
+
+TESTING DO +LOOP with run-time increment, negative increment, infinite loop
+\ Contributed by Reinhold Straub
+
+VARIABLE iterations
+VARIABLE increment
+: gd7 ( limit start increment -- )
+ increment !
+ 0 iterations !
+ DO
+ 1 iterations +!
+ I
+ iterations @ 6 = IF LEAVE THEN
+ increment @
+ +LOOP iterations @
+;
+
+T{ 4 4 -1 gd7 -> 4 1 }T
+T{ 1 4 -1 gd7 -> 4 3 2 1 4 }T
+T{ 4 1 -1 gd7 -> 1 0 -1 -2 -3 -4 6 }T
+T{ 4 1 0 gd7 -> 1 1 1 1 1 1 6 }T
+T{ 0 0 0 gd7 -> 0 0 0 0 0 0 6 }T
+T{ 1 4 0 gd7 -> 4 4 4 4 4 4 6 }T
+T{ 1 4 1 gd7 -> 4 5 6 7 8 9 6 }T
+T{ 4 1 1 gd7 -> 1 2 3 3 }T
+T{ 4 4 1 gd7 -> 4 5 6 7 8 9 6 }T
+T{ 2 -1 -1 gd7 -> -1 -2 -3 -4 -5 -6 6 }T
+T{ -1 2 -1 gd7 -> 2 1 0 -1 4 }T
+T{ 2 -1 0 gd7 -> -1 -1 -1 -1 -1 -1 6 }T
+T{ -1 2 0 gd7 -> 2 2 2 2 2 2 6 }T
+T{ -1 2 1 gd7 -> 2 3 4 5 6 7 6 }T
+T{ 2 -1 1 gd7 -> -1 0 1 3 }T
+T{ -20 30 -10 gd7 -> 30 20 10 0 -10 -20 6 }T
+T{ -20 31 -10 gd7 -> 31 21 11 1 -9 -19 6 }T
+T{ -20 29 -10 gd7 -> 29 19 9 -1 -11 5 }T
+
+\ ------------------------------------------------------------------------------
+TESTING DO +LOOP with large and small increments
+
+\ Contributed by Andrew Haley
+
+MAX-UINT 8 RSHIFT 1+ CONSTANT ustep
+ustep NEGATE CONSTANT -ustep
+MAX-INT 7 RSHIFT 1+ CONSTANT step
+step NEGATE CONSTANT -step
+
+VARIABLE bump
+
+T{ : gd8 bump ! DO 1+ bump @ +LOOP ; -> }T
+
+T{ 0 MAX-UINT 0 ustep gd8 -> 256 }T
+T{ 0 0 MAX-UINT -ustep gd8 -> 256 }T
+
+T{ 0 MAX-INT MIN-INT step gd8 -> 256 }T
+T{ 0 MIN-INT MAX-INT -step gd8 -> 256 }T
+
+\ Two's complement arithmetic, wraps around modulo wordsize
+\ Only tested if the Forth system does wrap around, use of conditional
+\ compilation deliberately avoided
+
+MAX-INT 1+ MIN-INT = CONSTANT +wrap?
+MIN-INT 1- MAX-INT = CONSTANT -wrap?
+MAX-UINT 1+ 0= CONSTANT +uwrap?
+0 1- MAX-UINT = CONSTANT -uwrap?
+
+: gd9 ( n limit start step f result -- )
+ >R IF gd8 ELSE 2DROP 2DROP R@ THEN -> R> }T
+;
+
+T{ 0 0 0 ustep +uwrap? 256 gd9
+T{ 0 0 0 -ustep -uwrap? 1 gd9
+T{ 0 MIN-INT MAX-INT step +wrap? 1 gd9
+T{ 0 MAX-INT MIN-INT -step -wrap? 1 gd9
+
+\ ------------------------------------------------------------------------------
+TESTING DO +LOOP with maximum and minimum increments
+
+: (-mi) MAX-INT DUP NEGATE + 0= IF MAX-INT NEGATE ELSE -32767 THEN ;
+(-mi) CONSTANT -max-int
+
+T{ 0 1 0 MAX-INT gd8 -> 1 }T
+T{ 0 -max-int NEGATE -max-int OVER gd8 -> 2 }T
+
+T{ 0 MAX-INT 0 MAX-INT gd8 -> 1 }T
+T{ 0 MAX-INT 1 MAX-INT gd8 -> 1 }T
+T{ 0 MAX-INT -1 MAX-INT gd8 -> 2 }T
+T{ 0 MAX-INT dup 1- MAX-INT gd8 -> 1 }T
+
+T{ 0 MIN-INT 1+ 0 MIN-INT gd8 -> 1 }T
+T{ 0 MIN-INT 1+ -1 MIN-INT gd8 -> 1 }T
+T{ 0 MIN-INT 1+ 1 MIN-INT gd8 -> 2 }T
+T{ 0 MIN-INT 1+ DUP MIN-INT gd8 -> 1 }T
+
+\ ------------------------------------------------------------------------------
+TESTING multiple RECURSEs in one colon definition
+
+: ack ( m n -- u ) \ Ackermann function, from Rosetta Code
+ OVER 0= IF NIP 1+ EXIT THEN \ ack(0, n) = n+1
+ SWAP 1- SWAP ( -- m-1 n )
+ DUP 0= IF 1+ RECURSE EXIT THEN \ ack(m, 0) = ack(m-1, 1)
+ 1- OVER 1+ SWAP RECURSE RECURSE \ ack(m, n) = ack(m-1, ack(m,n-1))
+;
+
+T{ 0 0 ack -> 1 }T
+T{ 3 0 ack -> 5 }T
+T{ 2 4 ack -> 11 }T
+
+\ ------------------------------------------------------------------------------
+TESTING multiple ELSE's in an IF statement
+\ Discussed on comp.lang.forth and accepted as valid ANS Forth
+
+: melse IF 1 ELSE 2 ELSE 3 ELSE 4 ELSE 5 THEN ;
+T{ 0 melse -> 2 4 }T
+T{ -1 melse -> 1 3 5 }T
+
+\ ------------------------------------------------------------------------------
+TESTING manipulation of >IN in interpreter mode
+
+T{ 123456 depth over 9 < 35 and + 3 + >in ! -> 123456 23456 3456 456 56 6 }T
+T{ 14145 8115 ?dup 0= 34 and >in +! tuck mod 14 >in ! GCD calculation -> 15 }T
+
+\ ------------------------------------------------------------------------------
+TESTING IMMEDIATE with CONSTANT VARIABLE and CREATE [ ... DOES> ]
+
+T{ 123 CONSTANT iw1 IMMEDIATE iw1 -> 123 }T
+T{ : iw2 iw1 LITERAL ; iw2 -> 123 }T
+T{ VARIABLE iw3 IMMEDIATE 234 iw3 ! iw3 @ -> 234 }T
+T{ : iw4 iw3 [ @ ] LITERAL ; iw4 -> 234 }T
+T{ :noname [ 345 ] iw3 [ ! ] ; DROP iw3 @ -> 345 }T
+T{ CREATE iw5 456 , IMMEDIATE -> }T
+T{ :noname iw5 [ @ iw3 ! ] ; DROP iw3 @ -> 456 }T
+T{ : iw6 CREATE , IMMEDIATE DOES> @ 1+ ; -> }T
+T{ 111 iw6 iw7 iw7 -> 112 }T
+T{ : iw8 iw7 LITERAL 1+ ; iw8 -> 113 }T
+T{ : iw9 CREATE , DOES> @ 2 + IMMEDIATE ; -> }T
+: find-iw bl word find nip ; ( -- 0 | 1 | -1 )
+T{ 222 iw9 iw10 find-iw iw10 -> -1 }T \ iw10 is not immediate
+T{ iw10 find-iw iw10 -> 224 1 }T \ iw10 becomes immediate
+
+\ ------------------------------------------------------------------------------
+TESTING parsing behaviour of S" ." and (
+\ which should parse to just beyond the terminating character no space needed
+
+T{ S" A string"2DROP -> }T
+T{ ( A comment)1234 -> 1234 }T
+T{ : pb1 cr ." You should see 2345: "." 2345"( A comment); pb1 -> }T
+
+\ ------------------------------------------------------------------------------
+
+CR .( End of additional Core tests) CR
diff --git a/amforth-6.5/common/lib/forth2012/tester/doubletest.fth b/amforth-6.5/common/lib/forth2012/tester/doubletest.fth
new file mode 100644
index 0000000..523b110
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/tester/doubletest.fth
@@ -0,0 +1,386 @@
+\ To test the ANS Forth Double-Number word set and double number extensions
+
+\ This program was written by Gerry Jackson in 2006, with contributions from
+\ others where indicated, and is in the public domain - it can be distributed
+\ and/or modified in any way but please retain this notice.
+
+\ This program is distributed in the hope that it will be useful,
+\ but WITHOUT ANY WARRANTY; without even the implied warranty of
+\ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+\ The tests are not claimed to be comprehensive or correct
+\ ------------------------------------------------------------------------------
+\ Version 0.6 1 April 2012 Tests placed in the public domain.
+\ Immediate 2CONSTANTs and 2VARIABLEs tested
+\ 0.5 20 November 2009 Various constants renamed to avoid
+\ redefinition warnings. <true> and <false> replaced
+\ with TRUE and FALSE
+\ 0.4 6 March 2009 { and } replaced with T{ and }T
+\ Tests rewritten to be independent of word size and
+\ tests re-ordered
+\ 0.3 20 April 2007 ANS Forth words changed to upper case
+\ 0.2 30 Oct 2006 Updated following GForth test to include
+\ various constants from core.fr
+\ 0.1 Oct 2006 First version released
+\ ------------------------------------------------------------------------------
+\ The tests are based on John Hayes test program for the core word set
+
+\ Words tested in this file are:
+\ 2CONSTANT 2LITERAL 2VARIABLE D+ D- D. D.R D0< D0= D2* D2/
+\ D< D= D>S DABS DMAX DMIN DNEGATE M*/ M+ 2ROT DU<
+\ Also tests the interpreter and compiler reading a double number
+\ ------------------------------------------------------------------------------
+\ Assumptions and dependencies:
+\ - tester.fr or ttester.fs has been included prior to this file
+\ - core words and core extension words have been tested
+\ ------------------------------------------------------------------------------
+\ Constant definitions
+
+DECIMAL
+0 INVERT CONSTANT 1sd
+1sd 1 RSHIFT CONSTANT max-intd \ 01...1
+max-intd INVERT CONSTANT min-intd \ 10...0
+max-intd 2/ CONSTANT hi-int \ 001...1
+min-intd 2/ CONSTANT lo-int \ 110...1
+
+\ ------------------------------------------------------------------------------
+TESTING interpreter and compiler reading a double number
+
+T{ 1. -> 1 0 }T
+T{ -2. -> -2 -1 }T
+T{ : rdl1 3. ; rdl1 -> 3 0 }T
+T{ : rdl2 -4. ; rdl2 -> -4 -1 }T
+
+\ ------------------------------------------------------------------------------
+TESTING 2CONSTANT
+
+T{ 1 2 2CONSTANT 2c1 -> }T
+T{ 2c1 -> 1 2 }T
+T{ : cd1 2c1 ; -> }T
+T{ cd1 -> 1 2 }T
+T{ : cd2 2CONSTANT ; -> }T
+T{ -1 -2 cd2 2c2 -> }T
+T{ 2c2 -> -1 -2 }T
+T{ 4 5 2CONSTANT 2c3 IMMEDIATE 2c3 -> 4 5 }T
+T{ : cd6 2c3 2LITERAL ; cd6 -> 4 5 }T
+
+\ ------------------------------------------------------------------------------
+\ Some 2CONSTANTs for the following tests
+
+1sd max-intd 2CONSTANT max-2int \ 01...1
+0 min-intd 2CONSTANT min-2int \ 10...0
+max-2int 2/ 2CONSTANT hi-2int \ 001...1
+min-2int 2/ 2CONSTANT lo-2int \ 110...0
+
+\ ------------------------------------------------------------------------------
+TESTING DNEGATE
+
+T{ 0. DNEGATE -> 0. }T
+T{ 1. DNEGATE -> -1. }T
+T{ -1. DNEGATE -> 1. }T
+T{ max-2int DNEGATE -> min-2int SWAP 1+ SWAP }T
+T{ min-2int SWAP 1+ SWAP DNEGATE -> max-2int }T
+
+\ ------------------------------------------------------------------------------
+TESTING D+ with small integers
+
+T{ 0. 5. D+ -> 5. }T
+T{ -5. 0. D+ -> -5. }T
+T{ 1. 2. D+ -> 3. }T
+T{ 1. -2. D+ -> -1. }T
+T{ -1. 2. D+ -> 1. }T
+T{ -1. -2. D+ -> -3. }T
+T{ -1. 1. D+ -> 0. }T
+
+TESTING D+ with mid range integers
+
+T{ 0 0 0 5 D+ -> 0 5 }T
+T{ -1 5 0 0 D+ -> -1 5 }T
+T{ 0 0 0 -5 D+ -> 0 -5 }T
+T{ 0 -5 -1 0 D+ -> -1 -5 }T
+T{ 0 1 0 2 D+ -> 0 3 }T
+T{ -1 1 0 -2 D+ -> -1 -1 }T
+T{ 0 -1 0 2 D+ -> 0 1 }T
+T{ 0 -1 -1 -2 D+ -> -1 -3 }T
+T{ -1 -1 0 1 D+ -> -1 0 }T
+T{ min-intd 0 2DUP D+ -> 0 1 }T
+T{ min-intd S>D min-intd 0 D+ -> 0 0 }T
+
+TESTING D+ with large double integers
+
+T{ hi-2int 1. D+ -> 0 hi-int 1+ }T
+T{ hi-2int 2DUP D+ -> 1sd 1- max-intd }T
+T{ max-2int min-2int D+ -> -1. }T
+T{ max-2int lo-2int D+ -> hi-2int }T
+T{ hi-2int min-2int D+ 1. D+ -> lo-2int }T
+T{ lo-2int 2DUP D+ -> min-2int }T
+
+\ ------------------------------------------------------------------------------
+TESTING D- with small integers
+
+T{ 0. 5. D- -> -5. }T
+T{ 5. 0. D- -> 5. }T
+T{ 0. -5. D- -> 5. }T
+T{ 1. 2. D- -> -1. }T
+T{ 1. -2. D- -> 3. }T
+T{ -1. 2. D- -> -3. }T
+T{ -1. -2. D- -> 1. }T
+T{ -1. -1. D- -> 0. }T
+
+TESTING D- with mid-range integers
+
+T{ 0 0 0 5 D- -> 0 -5 }T
+T{ -1 5 0 0 D- -> -1 5 }T
+T{ 0 0 -1 -5 D- -> 1 4 }T
+T{ 0 -5 0 0 D- -> 0 -5 }T
+T{ -1 1 0 2 D- -> -1 -1 }T
+T{ 0 1 -1 -2 D- -> 1 2 }T
+T{ 0 -1 0 2 D- -> 0 -3 }T
+T{ 0 -1 0 -2 D- -> 0 1 }T
+T{ 0 0 0 1 D- -> 0 -1 }T
+T{ min-intd 0 2DUP D- -> 0. }T
+T{ min-intd S>D max-intd 0 D- -> 1 1sd }T
+
+TESTING D- with large integers
+
+T{ max-2int max-2int D- -> 0. }T
+T{ min-2int min-2int D- -> 0. }T
+T{ max-2int hi-2int D- -> lo-2int DNEGATE }T
+T{ hi-2int lo-2int D- -> max-2int }T
+T{ lo-2int hi-2int D- -> min-2int 1. D+ }T
+T{ min-2int min-2int D- -> 0. }T
+T{ min-2int lo-2int D- -> lo-2int }T
+
+\ ------------------------------------------------------------------------------
+TESTING D0< D0=
+
+T{ 0. D0< -> FALSE }T
+T{ 1. D0< -> FALSE }T
+T{ min-intd 0 D0< -> FALSE }T
+T{ 0 max-intd D0< -> FALSE }T
+T{ max-2int D0< -> FALSE }T
+T{ -1. D0< -> TRUE }T
+T{ min-2int D0< -> TRUE }T
+
+T{ 1. D0= -> FALSE }T
+T{ min-intd 0 D0= -> FALSE }T
+T{ max-2int D0= -> FALSE }T
+T{ -1 max-intd D0= -> FALSE }T
+T{ 0. D0= -> TRUE }T
+T{ -1. D0= -> FALSE }T
+T{ 0 min-intd D0= -> FALSE }T
+
+\ ------------------------------------------------------------------------------
+TESTING D2* D2/
+
+T{ 0. D2* -> 0. D2* }T
+T{ min-intd 0 D2* -> 0 1 }T
+T{ hi-2int D2* -> max-2int 1. D- }T
+T{ lo-2int D2* -> min-2int }T
+
+T{ 0. D2/ -> 0. }T
+T{ 1. D2/ -> 0. }T
+T{ 0 1 D2/ -> min-intd 0 }T
+T{ max-2int D2/ -> hi-2int }T
+T{ -1. D2/ -> -1. }T
+T{ min-2int D2/ -> lo-2int }T
+
+\ ------------------------------------------------------------------------------
+TESTING D< D=
+
+T{ 0. 1. D< -> TRUE }T
+T{ 0. 0. D< -> FALSE }T
+T{ 1. 0. D< -> FALSE }T
+T{ -1. 1. D< -> TRUE }T
+T{ -1. 0. D< -> TRUE }T
+T{ -2. -1. D< -> TRUE }T
+T{ -1. -2. D< -> FALSE }T
+T{ -1. max-2int D< -> TRUE }T
+T{ min-2int max-2int D< -> TRUE }T
+T{ max-2int -1. D< -> FALSE }T
+T{ max-2int min-2int D< -> FALSE }T
+T{ max-2int 2DUP -1. D+ D< -> FALSE }T
+T{ min-2int 2DUP 1. D+ D< -> TRUE }T
+
+T{ -1. -1. D= -> TRUE }T
+T{ -1. 0. D= -> FALSE }T
+T{ -1. 1. D= -> FALSE }T
+T{ 0. -1. D= -> FALSE }T
+T{ 0. 0. D= -> TRUE }T
+T{ 0. 1. D= -> FALSE }T
+T{ 1. -1. D= -> FALSE }T
+T{ 1. 0. D= -> FALSE }T
+T{ 1. 1. D= -> TRUE }T
+
+T{ 0 -1 0 -1 D= -> TRUE }T
+T{ 0 -1 0 0 D= -> FALSE }T
+T{ 0 -1 0 1 D= -> FALSE }T
+T{ 0 0 0 -1 D= -> FALSE }T
+T{ 0 0 0 0 D= -> TRUE }T
+T{ 0 0 0 1 D= -> FALSE }T
+T{ 0 1 0 -1 D= -> FALSE }T
+T{ 0 1 0 0 D= -> FALSE }T
+T{ 0 1 0 1 D= -> TRUE }T
+
+T{ max-2int min-2int D= -> FALSE }T
+T{ max-2int 0. D= -> FALSE }T
+T{ max-2int max-2int D= -> TRUE }T
+T{ max-2int hi-2int D= -> FALSE }T
+T{ max-2int min-2int D= -> FALSE }T
+T{ min-2int min-2int D= -> TRUE }T
+T{ min-2int lo-2int D= -> FALSE }T
+T{ min-2int max-2int D= -> FALSE }T
+
+\ ------------------------------------------------------------------------------
+TESTING 2LITERAL 2VARIABLE
+
+T{ : cd3 [ max-2int ] 2LITERAL ; -> }T
+T{ cd3 -> max-2int }T
+T{ 2VARIABLE 2v1 -> }T
+T{ 0. 2v1 2! -> }T
+T{ 2v1 2@ -> 0. }T
+T{ -1 -2 2v1 2! -> }T
+T{ 2v1 2@ -> -1 -2 }T
+T{ : cd4 2VARIABLE ; -> }T
+T{ cd4 2v2 -> }T
+T{ : cd5 2v2 2! ; -> }T
+T{ -2 -1 cd5 -> }T
+T{ 2v2 2@ -> -2 -1 }T
+T{ 2VARIABLE 2v3 IMMEDIATE 5 6 2v3 2! -> }T
+T{ 2v3 2@ -> 5 6 }T
+T{ : cd7 2v3 [ 2@ ] 2LITERAL ; cd7 -> 5 6 }T
+T{ : cd8 [ 6 7 ] 2v3 [ 2! ] ; 2v3 2@ -> 6 7 }T
+
+\ ------------------------------------------------------------------------------
+TESTING DMAX DMIN
+
+T{ 1. 2. DMAX -> 2. }T
+T{ 1. 0. DMAX -> 1. }T
+T{ 1. -1. DMAX -> 1. }T
+T{ 1. 1. DMAX -> 1. }T
+T{ 0. 1. DMAX -> 1. }T
+T{ 0. -1. DMAX -> 0. }T
+T{ -1. 1. DMAX -> 1. }T
+T{ -1. -2. DMAX -> -1. }T
+
+T{ max-2int hi-2int DMAX -> max-2int }T
+T{ max-2int min-2int DMAX -> max-2int }T
+T{ min-2int max-2int DMAX -> max-2int }T
+T{ min-2int lo-2int DMAX -> lo-2int }T
+
+T{ max-2int 1. DMAX -> max-2int }T
+T{ max-2int -1. DMAX -> max-2int }T
+T{ min-2int 1. DMAX -> 1. }T
+T{ min-2int -1. DMAX -> -1. }T
+
+
+T{ 1. 2. DMIN -> 1. }T
+T{ 1. 0. DMIN -> 0. }T
+T{ 1. -1. DMIN -> -1. }T
+T{ 1. 1. DMIN -> 1. }T
+T{ 0. 1. DMIN -> 0. }T
+T{ 0. -1. DMIN -> -1. }T
+T{ -1. 1. DMIN -> -1. }T
+T{ -1. -2. DMIN -> -2. }T
+
+T{ max-2int hi-2int DMIN -> hi-2int }T
+T{ max-2int min-2int DMIN -> min-2int }T
+T{ min-2int max-2int DMIN -> min-2int }T
+T{ min-2int lo-2int DMIN -> min-2int }T
+
+T{ max-2int 1. DMIN -> 1. }T
+T{ max-2int -1. DMIN -> -1. }T
+T{ min-2int 1. DMIN -> min-2int }T
+T{ min-2int -1. DMIN -> min-2int }T
+
+\ ------------------------------------------------------------------------------
+TESTING D>S DABS
+
+T{ 1234 0 D>S -> 1234 }T
+T{ -1234 -1 D>S -> -1234 }T
+T{ max-intd 0 D>S -> max-intd }T
+T{ min-intd -1 D>S -> min-intd }T
+
+T{ 1. DABS -> 1. }T
+T{ -1. DABS -> 1. }T
+T{ max-2int DABS -> max-2int }T
+T{ min-2int 1. D+ DABS -> max-2int }T
+
+\ ------------------------------------------------------------------------------
+TESTING M+ M*/
+
+T{ hi-2int 1 M+ -> hi-2int 1. D+ }T
+T{ max-2int -1 M+ -> max-2int -1. D+ }T
+T{ min-2int 1 M+ -> min-2int 1. D+ }T
+T{ lo-2int -1 M+ -> lo-2int -1. D+ }T
+
+\ To correct the result if the division is floored, only used when
+\ necessary i.e. negative quotient and remainder <> 0
+
+: ?floored [ -3 2 / -2 = ] LITERAL IF 1. D- THEN ;
+
+T{ 5. 7 11 M*/ -> 3. }T
+T{ 5. -7 11 M*/ -> -3. ?floored }T \ floored -4.
+T{ -5. 7 11 M*/ -> -3. ?floored }T \ floored -4.
+T{ -5. -7 11 M*/ -> 3. }T
+T{ max-2int 8 16 M*/ -> hi-2int }T
+T{ max-2int -8 16 M*/ -> hi-2int DNEGATE ?floored }T \ floored subtract 1
+T{ min-2int 8 16 M*/ -> lo-2int }T
+T{ min-2int -8 16 M*/ -> lo-2int DNEGATE }T
+T{ max-2int max-intd max-intd M*/ -> max-2int }T
+T{ max-2int max-intd 2/ max-intd M*/ -> max-intd 1- hi-2int NIP }T
+T{ min-2int lo-2int NIP DUP NEGATE M*/ -> min-2int }T
+T{ min-2int lo-2int NIP 1- max-intd M*/ -> min-intd 3 + hi-2int NIP 2 + }T
+T{ max-2int lo-2int NIP DUP NEGATE M*/ -> max-2int DNEGATE }T
+T{ min-2int max-intd DUP M*/ -> min-2int }T
+
+\ ------------------------------------------------------------------------------
+TESTING D. D.R
+
+\ Create some large double numbers
+max-2int 71 73 M*/ 2CONSTANT dbl1
+min-2int 73 79 M*/ 2CONSTANT dbl2
+
+: d>ascii ( d -- caddr u )
+ DUP >R <# DABS #S R> SIGN #> ( -- caddr1 u )
+ HERE SWAP 2DUP 2>R CHARS DUP ALLOT MOVE 2R>
+;
+
+dbl1 d>ascii 2CONSTANT "dbl1"
+dbl2 d>ascii 2CONSTANT "dbl2"
+
+: DoubleOutput
+ CR ." You should see lines duplicated:" CR
+ 5 SPACES "dbl1" TYPE CR
+ 5 SPACES dbl1 D. CR
+ 8 SPACES "dbl1" DUP >R TYPE CR
+ 5 SPACES dbl1 R> 3 + D.R CR
+ 5 SPACES "dbl2" TYPE CR
+ 5 SPACES dbl2 D. CR
+ 10 SPACES "dbl2" DUP >R TYPE CR
+ 5 SPACES dbl2 R> 5 + D.R CR
+;
+
+T{ DoubleOutput -> }T
+
+\ ------------------------------------------------------------------------------
+TESTING 2ROT DU< (Double Number extension words)
+
+T{ 1. 2. 3. 2ROT -> 2. 3. 1. }T
+T{ max-2int min-2int 1. 2ROT -> min-2int 1. max-2int }T
+
+T{ 1. 1. DU< -> FALSE }T
+T{ 1. -1. DU< -> TRUE }T
+T{ -1. 1. DU< -> FALSE }T
+T{ -1. -2. DU< -> FALSE }T
+
+T{ max-2int hi-2int DU< -> FALSE }T
+T{ hi-2int max-2int DU< -> TRUE }T
+T{ max-2int min-2int DU< -> TRUE }T
+T{ min-2int max-2int DU< -> FALSE }T
+T{ min-2int lo-2int DU< -> TRUE }T
+
+\ ------------------------------------------------------------------------------
+
+CR .( End of Double-Number word tests) CR
+
diff --git a/amforth-6.5/common/lib/forth2012/tester/exceptiontest.fth b/amforth-6.5/common/lib/forth2012/tester/exceptiontest.fth
new file mode 100644
index 0000000..7b612bf
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/tester/exceptiontest.fth
@@ -0,0 +1,96 @@
+\ To test the ANS Forth Exception word set and extension words
+
+\ This program was written by Gerry Jackson in 2006, with contributions from
+\ others where indicated, and is in the public domain - it can be distributed
+\ and/or modified in any way but please retain this notice.
+
+\ This program is distributed in the hope that it will be useful,
+\ but WITHOUT ANY WARRANTY; without even the implied warranty of
+\ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+\ The tests are not claimed to be comprehensive or correct
+
+\ ------------------------------------------------------------------------------
+\ Version 0.4 1 April 2012 Tests placed in the public domain.
+\ 0.3 6 March 2009 { and } replaced with T{ and }T
+\ 0.2 20 April 2007 ANS Forth words changed to upper case
+\ 0.1 Oct 2006 First version released
+
+\ ------------------------------------------------------------------------------
+\ The tests are based on John Hayes test program for the core word set
+\
+\ Words tested in this file are:
+\ CATCH THROW ABORT ABORT"
+\
+\ ------------------------------------------------------------------------------
+\ Assumptions and dependencies:
+\ - the forth system under test throws an exception with throw
+\ code -13 for a word not found by the text interpreter. The
+\ undefined word used is $$qweqweqwert$$, if this happens to be
+\ a valid word in your system change the definition of t7 below
+\ - tester.fr or ttester.fs has been loaded prior to this file
+\ - CASE, OF, ENDOF and ENDCASE from the core extension wordset
+\ are present and work correctly
+\ ------------------------------------------------------------------------------
+TESTING CATCH THROW
+
+DECIMAL
+
+: t1 9 ;
+: c1 1 2 3 ['] t1 CATCH ;
+T{ c1 -> 1 2 3 9 0 }T \ No THROW executed
+
+: t2 8 0 THROW ;
+: c2 1 2 ['] t2 CATCH ;
+T{ c2 -> 1 2 8 0 }T \ 0 THROW does nothing
+
+: t3 7 8 9 99 THROW ;
+: c3 1 2 ['] t3 CATCH ;
+T{ c3 -> 1 2 99 }T \ Restores stack to CATCH depth
+
+: t4 1- DUP 0> IF RECURSE ELSE 999 THROW -222 THEN ;
+: c4 3 4 5 10 ['] t4 CATCH -111 ;
+T{ c4 -> 3 4 5 0 999 -111 }T \ Test return stack unwinding
+
+: t5 2DROP 2DROP 9999 THROW ;
+: c5 1 2 3 4 ['] t5 CATCH \ Test depth restored correctly
+ DEPTH >R DROP 2DROP 2DROP R> ; \ after stack has been emptied
+T{ c5 -> 5 }T
+
+\ ------------------------------------------------------------------------------
+TESTING ABORT ABORT"
+
+-1 CONSTANT exc_abort
+-2 CONSTANT exc_abort"
+-13 CONSTANT exc_undef
+: t6 ABORT ;
+
+\ The 77 in t10 is necessary for the second ABORT" test as the data stack
+\ is restored to a depth of 2 when THROW is executed. The 77 ensures the top
+\ of stack value is known for the results check
+
+: t10 77 SWAP ABORT" This should not be displayed" ;
+: c6 CATCH
+ CASE exc_abort OF 11 ENDOF
+ exc_abort" OF 12 ENDOF
+ exc_undef OF 13 ENDOF
+ ENDCASE
+;
+
+T{ 1 2 ' t6 c6 -> 1 2 11 }T \ Test that ABORT is caught
+T{ 3 0 ' t10 c6 -> 3 77 }T \ ABORT" does nothing
+T{ 4 5 ' t10 c6 -> 4 77 12 }T \ ABORT" caught, no message
+
+\ ------------------------------------------------------------------------------
+TESTING a system generated exception
+
+: t7 S" 333 $$qweqweqwert$$ 334" EVALUATE 335 ;
+: t8 S" 222 t7 223" EVALUATE 224 ;
+: t9 S" 111 112 t8 113" EVALUATE 114 ;
+
+T{ 6 7 ' t9 c6 3 -> 6 7 13 3 }T \ Test unlinking of sources
+
+\ ------------------------------------------------------------------------------
+
+CR .( End of Exception word tests) CR
+
diff --git a/amforth-6.5/common/lib/forth2012/tester/filetest.fth b/amforth-6.5/common/lib/forth2012/tester/filetest.fth
new file mode 100644
index 0000000..0364360
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/tester/filetest.fth
@@ -0,0 +1,193 @@
+\ To test the ANS File Access word set and extension words
+
+\ This program was written by Gerry Jackson in 2006, with contributions from
+\ others where indicated, and is in the public domain - it can be distributed
+\ and/or modified in any way but please retain this notice.
+
+\ This program is distributed in the hope that it will be useful,
+\ but WITHOUT ANY WARRANTY; without even the implied warranty of
+\ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+\ The tests are not claimed to be comprehensive or correct
+
+\ ------------------------------------------------------------------------------
+\ Version 0.5 1 April 2012 Tests placed in the public domain.
+\ 0.4 22 March 2009 { and } replaced with T{ and }T
+\ 0.3 20 April 2007 ANS Forth words changed to upper case.
+\ Removed directory test from the filenames.
+\ 0.2 30 Oct 2006 updated following GForth tests to remove
+\ system dependency on file size, to allow for file
+\ buffering and to allow for PAD moving around.
+\ 0.1 Oct 2006 First version released.
+
+\ ------------------------------------------------------------------------------
+\ The tests are based on John Hayes test program for the core word set
+\ and requires those files to have been loaded
+
+\ Words tested in this file are:
+\ ( BIN CLOSE-FILE CREATE-FILE DELETE-FILE FILE-POSITION FILE-SIZE
+\ OPEN-FILE R/O R/W READ-FILE READ-LINE REPOSITION-FILE RESIZE-FILE
+\ S" SOURCE-ID W/O WRITE-FILE WRITE-LINE
+\ FILE-STATUS FLUSH-FILE RENAME-FILE
+
+\ Words not tested:
+\ REFILL INCLUDED INCLUDE-FILE (as these will likely have been
+\ tested in the execution of the test files)
+\ ------------------------------------------------------------------------------
+\ Assumptions, dependencies and notes:
+\ - tester.fr or ttester.fs has been loaded prior to this file
+\ - These tests create files in the current directory, if all goes
+\ well these will be deleted. If something fails they may not be
+\ deleted. If this is a problem ensure you set a suitable
+\ directory before running this test. There is no ANS standard
+\ way of doing this. Also be aware of the file names used below
+\ which are: fatest1.txt, fatest2.txt and fatest3.txt
+\ - TRUE and FALSE are present from the Core extension word set
+\ ------------------------------------------------------------------------------
+
+TESTING File Access word set
+
+DECIMAL
+
+\ ------------------------------------------------------------------------------
+TESTING CREATE-FILE CLOSE-FILE
+
+: fn1 S" fatest1.txt" ;
+VARIABLE fid1
+
+T{ fn1 R/W CREATE-FILE SWAP fid1 ! -> 0 }T
+T{ fid1 @ CLOSE-FILE -> 0 }T
+
+\ ------------------------------------------------------------------------------
+TESTING OPEN-FILE W/O WRITE-LINE
+
+: line1 S" Line 1" ;
+
+T{ fn1 W/O OPEN-FILE SWAP fid1 ! -> 0 }T
+T{ line1 fid1 @ WRITE-LINE -> 0 }T
+T{ fid1 @ CLOSE-FILE -> 0 }T
+
+\ ------------------------------------------------------------------------------
+TESTING R/O FILE-POSITION (simple) READ-LINE
+
+200 CONSTANT bsize
+CREATE buf bsize ALLOT
+VARIABLE #chars
+
+T{ fn1 R/O OPEN-FILE SWAP fid1 ! -> 0 }T
+T{ fid1 @ FILE-POSITION -> 0. 0 }T
+T{ buf 100 fid1 @ READ-LINE ROT DUP #chars ! -> TRUE 0 line1 SWAP DROP }T
+T{ buf #chars @ line1 COMPARE -> 0 }T
+T{ fid1 @ CLOSE-FILE -> 0 }T
+
+\ ------------------------------------------------------------------------------
+TESTING R/W WRITE-FILE REPOSITION-FILE READ-FILE FILE-POSITION S"
+
+: line2 S" Line 2 blah blah blah" ;
+: rl1 buf 100 fid1 @ READ-LINE ;
+2VARIABLE fp
+
+T{ fn1 R/W OPEN-FILE SWAP fid1 ! -> 0 }T
+T{ fid1 @ FILE-SIZE DROP fid1 @ REPOSITION-FILE -> 0 }T
+T{ fid1 @ FILE-SIZE -> fid1 @ FILE-POSITION }T
+T{ line2 fid1 @ WRITE-FILE -> 0 }T
+T{ 10. fid1 @ REPOSITION-FILE -> 0 }T
+T{ fid1 @ FILE-POSITION -> 10. 0 }T
+T{ 0. fid1 @ REPOSITION-FILE -> 0 }T
+T{ rl1 -> line1 SWAP DROP TRUE 0 }T
+T{ rl1 ROT DUP #chars ! -> TRUE 0 line2 SWAP DROP }T
+T{ buf #chars @ line2 COMPARE -> 0 }T
+T{ rl1 -> 0 FALSE 0 }T
+T{ fid1 @ FILE-POSITION ROT ROT fp 2! -> 0 }T
+T{ fp 2@ fid1 @ FILE-SIZE DROP D= -> TRUE }T
+T{ S" " fid1 @ WRITE-LINE -> 0 }T
+T{ S" " fid1 @ WRITE-LINE -> 0 }T
+T{ fp 2@ fid1 @ REPOSITION-FILE -> 0 }T
+T{ rl1 -> 0 TRUE 0 }T
+T{ rl1 -> 0 TRUE 0 }T
+T{ rl1 -> 0 FALSE 0 }T
+T{ fid1 @ CLOSE-FILE -> 0 }T
+
+\ ------------------------------------------------------------------------------
+TESTING BIN READ-FILE FILE-SIZE
+
+: cbuf buf bsize 0 FILL ;
+: fn2 S" fatest2.txt" ;
+VARIABLE fid2
+: setpad PAD 50 0 DO I OVER C! CHAR+ LOOP DROP ;
+
+setpad \ If anything else is defined setpad must be called again
+ \ as pad may move
+
+T{ fn2 R/W BIN CREATE-FILE SWAP fid2 ! -> 0 }T
+T{ PAD 50 fid2 @ WRITE-FILE fid2 @ FLUSH-FILE -> 0 0 }T
+T{ fid2 @ FILE-SIZE -> 50. 0 }T
+T{ 0. fid2 @ REPOSITION-FILE -> 0 }T
+T{ cbuf buf 29 fid2 @ READ-FILE -> 29 0 }T
+T{ PAD 29 buf 29 COMPARE -> 0 }T
+T{ PAD 30 buf 30 COMPARE -> 1 }T
+T{ cbuf buf 29 fid2 @ READ-FILE -> 21 0 }T
+T{ PAD 29 + 21 buf 21 COMPARE -> 0 }T
+T{ fid2 @ FILE-SIZE DROP fid2 @ FILE-POSITION DROP D= -> TRUE }T
+T{ buf 10 fid2 @ READ-FILE -> 0 0 }T
+T{ fid2 @ CLOSE-FILE -> 0 }T
+
+\ ------------------------------------------------------------------------------
+TESTING RESIZE-FILE
+
+T{ fn2 R/W BIN OPEN-FILE SWAP fid2 ! -> 0 }T
+T{ 37. fid2 @ RESIZE-FILE -> 0 }T
+T{ fid2 @ FILE-SIZE -> 37. 0 }T
+T{ 0. fid2 @ REPOSITION-FILE -> 0 }T
+T{ cbuf buf 100 fid2 @ READ-FILE -> 37 0 }T
+T{ PAD 37 buf 37 COMPARE -> 0 }T
+T{ PAD 38 buf 38 COMPARE -> 1 }T
+T{ 500. fid2 @ RESIZE-FILE -> 0 }T
+T{ fid2 @ FILE-SIZE -> 500. 0 }T
+T{ 0. fid2 @ REPOSITION-FILE -> 0 }T
+T{ cbuf buf 100 fid2 @ READ-FILE -> 100 0 }T
+T{ PAD 37 buf 37 COMPARE -> 0 }T
+T{ fid2 @ CLOSE-FILE -> 0 }T
+
+\ ------------------------------------------------------------------------------
+TESTING DELETE-FILE
+
+T{ fn2 DELETE-FILE -> 0 }T
+T{ fn2 R/W BIN OPEN-FILE SWAP DROP 0= -> FALSE }T
+T{ fn2 DELETE-FILE 0= -> FALSE }T
+
+\ ------------------------------------------------------------------------------
+TESTING multi-line ( comments
+
+T{ ( 1 2 3
+4 5 6
+7 8 9 ) 11 22 33 -> 11 22 33 }T
+
+\ ------------------------------------------------------------------------------
+TESTING SOURCE-ID (can only test it does not return 0 or -1)
+
+T{ SOURCE-ID DUP -1 = SWAP 0= OR -> FALSE }T
+
+\ ------------------------------------------------------------------------------
+TESTING RENAME-FILE FILE-STATUS FLUSH-FILE
+
+: fn3 S" fatest3.txt" ;
+: >end fid1 @ FILE-SIZE DROP fid1 @ REPOSITION-FILE ;
+
+
+T{ fn3 DELETE-FILE DROP -> }T
+T{ fn1 fn3 RENAME-FILE 0= -> TRUE }T
+T{ fn1 FILE-STATUS SWAP DROP 0= -> FALSE }T
+T{ fn3 FILE-STATUS SWAP DROP 0= -> TRUE }T \ Return value is undefined
+T{ fn3 R/W OPEN-FILE SWAP fid1 ! -> 0 }T
+T{ >end -> 0 }T
+T{ S" Final line" fid1 @ WRITE-LINE -> 0 }T
+T{ fid1 @ FLUSH-FILE -> 0 }T \ Can only test FLUSH-FILE doesn't fail
+T{ fid1 @ CLOSE-FILE -> 0 }T
+
+\ Tidy the test folder
+T{ fn3 DELETE-FILE DROP -> }T
+
+\ ------------------------------------------------------------------------------
+
+CR .( End of File-Access word tests) CR
diff --git a/amforth-6.5/common/lib/forth2012/tester/memorytest.fth b/amforth-6.5/common/lib/forth2012/tester/memorytest.fth
new file mode 100644
index 0000000..1967fc3
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/tester/memorytest.fth
@@ -0,0 +1,93 @@
+\ To test the ANS Forth Memory-Allocation word set
+
+\ This program was written by Gerry Jackson in 2006, with contributions from
+\ others where indicated, and is in the public domain - it can be distributed
+\ and/or modified in any way but please retain this notice.
+
+\ This program is distributed in the hope that it will be useful,
+\ but WITHOUT ANY WARRANTY; without even the implied warranty of
+\ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+\ The tests are not claimed to be comprehensive or correct
+
+\ ------------------------------------------------------------------------------
+\ Version 0.7 1 April 2012 Tests placed in the public domain.
+\ 0.6 30 January 2011 CHECKMEM modified to work with ttester.fs
+\ 0.5 30 November 2009 <false> replaced with FALSE
+\ 0.4 9 March 2009 Aligned test improved and data space pointer tested
+\ 0.3 6 March 2009 { and } replaced with T{ and }T
+\ 0.2 20 April 2007 ANS Forth words changed to upper case
+\ 0.1 October 2006 First version released
+
+\ ------------------------------------------------------------------------------
+\ The tests are based on John Hayes test program for the core word set
+\ and requires those files to have been loaded
+
+\ Words tested in this file are:
+\ ALLOCATE FREE RESIZE
+\
+\ ------------------------------------------------------------------------------
+\ Assumptions and dependencies:
+\ - that 'addr -1 ALLOCATE' and 'addr -1 RESIZE' will return an error
+\ - tester.fr or ttester.fs has been loaded prior to this file
+\ - testing FREE failing is not done as it is likely to crash the
+\ system
+\ ------------------------------------------------------------------------------
+
+TESTING Memory-Allocation word set
+
+DECIMAL
+
+\ ------------------------------------------------------------------------------
+TESTING ALLOCATE FREE RESIZE
+
+VARIABLE addr1
+VARIABLE datsp
+
+HERE datsp !
+T{ 100 ALLOCATE SWAP addr1 ! -> 0 }T
+T{ addr1 @ ALIGNED -> addr1 @ }T \ Test address is aligned
+T{ HERE -> datsp @ }T \ Check data space pointer is unchanged
+T{ addr1 @ FREE -> 0 }T
+
+T{ 99 ALLOCATE SWAP addr1 ! -> 0 }T
+T{ addr1 @ ALIGNED -> addr1 @ }T
+T{ addr1 @ FREE -> 0 }T
+
+T{ 50 ALLOCATE SWAP addr1 ! -> 0 }T
+
+: writemem 0 DO I 1+ OVER C! 1+ LOOP DROP ; ( ad n -- )
+
+\ checkmem is defined this way to maintain compatibility with both
+\ tester.fr and ttester.fs which differ in their definitions of T{
+
+: checkmem ( ad n --- )
+ 0
+ DO
+ >R
+ T{ R@ C@ -> R> I 1+ SWAP >R }T
+ R> 1+
+ LOOP
+ DROP
+;
+
+addr1 @ 50 writemem addr1 @ 50 checkmem
+
+T{ addr1 @ 28 RESIZE SWAP addr1 ! -> 0 }T
+addr1 @ 28 checkmem
+
+T{ addr1 @ 200 RESIZE SWAP addr1 ! -> 0 }T
+addr1 @ 28 checkmem
+
+\ ------------------------------------------------------------------------------
+TESTING failure of RESIZE and ALLOCATE (unlikely to be enough memory)
+
+T{ addr1 @ -1 RESIZE 0= -> addr1 @ FALSE }T
+
+T{ addr1 @ FREE -> 0 }T
+
+T{ -1 ALLOCATE SWAP DROP 0= -> FALSE }T \ Memory allocate failed
+
+\ ------------------------------------------------------------------------------
+
+CR .( End of Memory-Allocation word tests) CR
diff --git a/amforth-6.5/common/lib/forth2012/tester/postponetest.fs b/amforth-6.5/common/lib/forth2012/tester/postponetest.fs
new file mode 100644
index 0000000..b178be6
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/tester/postponetest.fs
@@ -0,0 +1,379 @@
+\ checks that postpone works correctly with words with special
+\ compilation semantics
+
+\ by M. Anton Ertl 1996
+
+\ This file is based on John Hayes' core.fr (coretest.fs), which has
+\ the following copyright notice:
+
+\ (C) 1995 JOHNS HOPKINS UNIVERSITY / APPLIED PHYSICS LABORATORY
+\ MAY BE DISTRIBUTED FREELY AS LONG AS THIS COPYRIGHT NOTICE REMAINS.
+
+\ my contributions to this file are in the public domain
+
+\ you have to load John Hayes' tester.fs (=tester.fr) and coretest.fs
+\ (core.fr) first
+
+\ These tests are especially useful for showing that state-smart
+\ implementations of words with special compilation semantics,
+\ combined with a straight-forward implementation of POSTPONE (and
+\ [COMPILE]) do not conform to the ANS Forth standard. The essential
+\ sentences in the standad are:
+
+\ 6.1.2033 POSTPONE CORE
+\ ...
+\ Compilation: ( <spaces>name -- )
+
+\ Skip leading space delimiters. Parse name delimited by a space. Find
+\ name. Append the compilation semantics of name to the current
+\ definition.
+
+\ 6.2.2530 [COMPILE] bracket-compile CORE EXT
+\ ...
+\ Compilation: ( <spaces>name -- )
+
+\ Skip leading space delimiters. Parse name delimited by a space. Find
+\ name. If name has other than default compilation semantics, append
+\ them to the current definition;...
+
+
+\ Note that the compilation semantics are appended, not some
+\ state-dependent semantics.
+
+\ first I test against a non-ANS solution suggested by Bernd Paysan
+
+: STATE@-NOW ( -- F )
+ STATE @ ; IMMEDIATE
+
+: STATE@ ( -- F )
+ POSTPONE STATE@-NOW ;
+
+t{ STATE@ -> STATE @ }t
+
+0 INVERT CONSTANT MAX-UINT
+0 INVERT 1 RSHIFT CONSTANT MAX-INT
+0 INVERT 1 RSHIFT INVERT CONSTANT MIN-INT
+0 INVERT 1 RSHIFT CONSTANT MID-UINT
+0 INVERT 1 RSHIFT INVERT CONSTANT MID-UINT+1
+
+\ here I test POSTPONE with all core words with special compilation
+\ semantics.
+
+TESTING POSTPONE +LOOP
+
+: POSTPONE-+LOOP
+ POSTPONE +LOOP ;
+
+t{ : PGD2 DO I -1 [ POSTPONE-+LOOP ] ; -> }t
+t{ 1 4 PGD2 -> 4 3 2 1 }t
+t{ -1 2 PGD2 -> 2 1 0 -1 }t
+t{ MID-UINT MID-UINT+1 PGD2 -> MID-UINT+1 MID-UINT }t
+
+t{ : PGD4 DO 1 0 DO J LOOP -1 [ POSTPONE-+LOOP ] ; -> }t
+t{ 1 4 PGD4 -> 4 3 2 1 }t
+t{ -1 2 PGD4 -> 2 1 0 -1 }t
+t{ MID-UINT MID-UINT+1 PGD4 -> MID-UINT+1 MID-UINT }t
+
+TESTING POSTPONE ."
+
+: POSTPONE-."
+ POSTPONE ." ;
+
+: PDQ2 [ POSTPONE-." YOU SHOULD SEE THIS LATER. " ] CR ;
+: PDQ1 [ POSTPONE-." YOU SHOULD SEE THIS FIRST. " ] CR ;
+t{ PDQ1 PDQ2 -> }t
+
+TESTING POSTPONE ;
+: POSTPONE-;
+ POSTPONE ; ;
+
+t{ : PSC [ POSTPONE-; -> }t
+t{ PSC -> }t
+
+TESTING POSTPONE ABORT"
+
+: POSTPONE-ABORT"
+ POSTPONE ABORT" ;
+
+t{ : PAQ1 [ POSTPONE-ABORT" THIS SHOULD NOT ABORT" ] ; -> }t
+
+TESTING POSTPONE BEGIN
+: POSTPONE-BEGIN
+ POSTPONE BEGIN ;
+
+t{ : PB3 [ POSTPONE-BEGIN ] DUP 5 < WHILE DUP 1+ REPEAT ; -> }t
+t{ 0 PB3 -> 0 1 2 3 4 5 }t
+t{ 4 PB3 -> 4 5 }t
+t{ 5 PB3 -> 5 }t
+t{ 6 PB3 -> 6 }t
+
+t{ : PB4 [ POSTPONE-BEGIN ] DUP 1+ DUP 5 > UNTIL ; -> }t
+t{ 3 PB4 -> 3 4 5 6 }t
+t{ 5 PB4 -> 5 6 }t
+t{ 6 PB4 -> 6 7 }t
+
+t{ : PB5 [ POSTPONE-BEGIN ] DUP 2 > WHILE DUP 5 < WHILE DUP 1+ REPEAT 123 ELSE 345 THEN ; -> }t
+t{ 1 PB5 -> 1 345 }t
+t{ 2 PB5 -> 2 345 }t
+t{ 3 PB5 -> 3 4 5 123 }t
+t{ 4 PB5 -> 4 5 123 }t
+t{ 5 PB5 -> 5 123 }t
+
+TESTING POSTPONE DO
+: POSTPONE-DO
+ POSTPONE DO ;
+
+t{ : PDO1 [ POSTPONE-DO ] I LOOP ; -> }t
+t{ 4 1 PDO1 -> 1 2 3 }t
+t{ 2 -1 PDO1 -> -1 0 1 }t
+t{ MID-UINT+1 MID-UINT PDO1 -> MID-UINT }t
+
+t{ : PDO2 [ POSTPONE-DO ] I -1 +LOOP ; -> }t
+t{ 1 4 PDO2 -> 4 3 2 1 }t
+t{ -1 2 PDO2 -> 2 1 0 -1 }t
+t{ MID-UINT MID-UINT+1 PDO2 -> MID-UINT+1 MID-UINT }t
+
+t{ : PDO3 [ POSTPONE-DO ] 1 0 [ POSTPONE-DO ] J LOOP LOOP ; -> }t
+t{ 4 1 PDO3 -> 1 2 3 }t
+t{ 2 -1 PDO3 -> -1 0 1 }t
+t{ MID-UINT+1 MID-UINT PDO3 -> MID-UINT }t
+
+t{ : PDO4 [ POSTPONE-DO ] 1 0 [ POSTPONE-DO ] J LOOP -1 +LOOP ; -> }t
+t{ 1 4 PDO4 -> 4 3 2 1 }t
+t{ -1 2 PDO4 -> 2 1 0 -1 }t
+t{ MID-UINT MID-UINT+1 PDO4 -> MID-UINT+1 MID-UINT }t
+
+t{ : PDO5 123 SWAP 0 [ POSTPONE-DO ] I 4 > IF DROP 234 LEAVE THEN LOOP ; -> }t
+t{ 1 PDO5 -> 123 }t
+t{ 5 PDO5 -> 123 }t
+t{ 6 PDO5 -> 234 }t
+
+t{ : PDO6 ( PAT: {0 0},{0 0}{1 0}{1 1},{0 0}{1 0}{1 1}{2 0}{2 1}{2 2} )
+ 0 SWAP 0 [ POSTPONE-DO ]
+ I 1+ 0 [ POSTPONE-DO ] I J + 3 = IF I UNLOOP I UNLOOP EXIT THEN 1+ LOOP
+ LOOP ; -> }t
+t{ 1 PDO6 -> 1 }t
+t{ 2 PDO6 -> 3 }t
+t{ 3 PDO6 -> 4 1 2 }t
+
+TESTING POSTPONE DOES>
+: POSTPONE-DOES>
+ POSTPONE DOES> ;
+
+t{ : PDOES1 [ POSTPONE-DOES> ] @ 1 + ; -> }t
+t{ : PDOES2 [ POSTPONE-DOES> ] @ 2 + ; -> }t
+t{ CREATE PCR1 -> }t
+t{ PCR1 -> HERE }t
+t{ ' PCR1 >BODY -> HERE }t
+t{ 1 , -> }t
+t{ PCR1 @ -> 1 }t
+t{ PDOES1 -> }t
+t{ PCR1 -> 2 }t
+t{ PDOES2 -> }t
+t{ PCR1 -> 3 }t
+
+t{ : PWEIRD: CREATE [ POSTPONE-DOES> ] 1 + [ POSTPONE-DOES> ] 2 + ; -> }t
+t{ PWEIRD: PW1 -> }t
+t{ ' PW1 >BODY -> HERE }t
+t{ PW1 -> HERE 1 + }t
+t{ PW1 -> HERE 2 + }t
+
+TESTING POSTPONE ELSE
+: POSTPONE-ELSE
+ POSTPONE ELSE ;
+
+t{ : PELSE1 IF 123 [ POSTPONE-ELSE ] 234 THEN ; -> }t
+t{ 0 PELSE1 -> 234 }t
+t{ 1 PELSE1 -> 123 }t
+
+t{ : PELSE2 BEGIN DUP 2 > WHILE DUP 5 < WHILE DUP 1+ REPEAT 123 [ POSTPONE-ELSE ] 345 THEN ; -> }t
+t{ 1 PELSE2 -> 1 345 }t
+t{ 2 PELSE2 -> 2 345 }t
+t{ 3 PELSE2 -> 3 4 5 123 }t
+t{ 4 PELSE2 -> 4 5 123 }t
+t{ 5 PELSE2 -> 5 123 }t
+
+TESTING POSTPONE IF
+: POSTPONE-IF
+ POSTPONE IF ;
+
+t{ : PIF1 [ POSTPONE-IF ] 123 THEN ; -> }t
+t{ : PIF2 [ POSTPONE-IF ] 123 ELSE 234 THEN ; -> }t
+t{ 0 PIF1 -> }t
+t{ 1 PIF1 -> 123 }t
+t{ -1 PIF1 -> 123 }t
+t{ 0 PIF2 -> 234 }t
+t{ 1 PIF2 -> 123 }t
+t{ -1 PIF1 -> 123 }t
+
+t{ : PIF6 ( N -- 0,1,..N ) DUP [ POSTPONE-IF ] DUP >R 1- RECURSE R> THEN ; -> }t
+t{ 0 PIF6 -> 0 }t
+t{ 1 PIF6 -> 0 1 }t
+t{ 2 PIF6 -> 0 1 2 }t
+t{ 3 PIF6 -> 0 1 2 3 }t
+t{ 4 PIF6 -> 0 1 2 3 4 }t
+
+TESTING POSTPONE LITERAL
+: POSTPONE-LITERAL
+ POSTPONE LITERAL ;
+
+t{ : PLIT [ 42 POSTPONE-LITERAL ] ; -> }t
+t{ PLIT -> 42 }t
+
+TESTING POSTPONE LOOP
+: POSTPONE-LOOP
+ POSTPONE LOOP ;
+
+t{ : PLOOP1 DO I [ POSTPONE-LOOP ] ; -> }t
+t{ 4 1 PLOOP1 -> 1 2 3 }t
+t{ 2 -1 PLOOP1 -> -1 0 1 }t
+t{ MID-UINT+1 MID-UINT PLOOP1 -> MID-UINT }t
+
+t{ : PLOOP3 DO 1 0 DO J [ POSTPONE-LOOP ] [ POSTPONE-LOOP ] ; -> }t
+t{ 4 1 PLOOP3 -> 1 2 3 }t
+t{ 2 -1 PLOOP3 -> -1 0 1 }t
+t{ MID-UINT+1 MID-UINT PLOOP3 -> MID-UINT }t
+
+t{ : PLOOP4 DO 1 0 DO J [ POSTPONE-LOOP ] -1 +LOOP ; -> }t
+t{ 1 4 PLOOP4 -> 4 3 2 1 }t
+t{ -1 2 PLOOP4 -> 2 1 0 -1 }t
+t{ MID-UINT MID-UINT+1 PLOOP4 -> MID-UINT+1 MID-UINT }t
+
+t{ : PLOOP5 123 SWAP 0 DO I 4 > IF DROP 234 LEAVE THEN [ POSTPONE-LOOP ] ; -> }t
+t{ 1 PLOOP5 -> 123 }t
+t{ 5 PLOOP5 -> 123 }t
+t{ 6 PLOOP5 -> 234 }t
+
+t{ : PLOOP6 ( PAT: {0 0},{0 0}{1 0}{1 1},{0 0}{1 0}{1 1}{2 0}{2 1}{2 2} )
+ 0 SWAP 0 DO
+ I 1+ 0 DO I J + 3 = IF I UNLOOP I UNLOOP EXIT THEN 1+ [ POSTPONE-LOOP ]
+ [ POSTPONE-LOOP ] ; -> }t
+t{ 1 PLOOP6 -> 1 }t
+t{ 2 PLOOP6 -> 3 }t
+t{ 3 PLOOP6 -> 4 1 2 }t
+
+TESTING POSTPONE POSTPONE
+: POSTPONE-POSTPONE
+ POSTPONE POSTPONE ;
+
+t{ : PPP1 123 ; -> }t
+t{ : PPP4 [ POSTPONE-POSTPONE PPP1 ] ; IMMEDIATE -> }t
+t{ : PPP5 PPP4 ; -> }t
+t{ PPP5 -> 123 }t
+t{ : PPP6 345 ; IMMEDIATE -> }t
+t{ : PPP7 [ POSTPONE-POSTPONE PPP6 ] ; -> }t
+t{ PPP7 -> 345 }t
+
+TESTING POSTPONE RECURSE
+: POSTPONE-RECURSE
+ POSTPONE RECURSE ;
+
+t{ : GREC ( N -- 0,1,..N ) DUP IF DUP >R 1- [ POSTPONE-RECURSE ] R> THEN ; -> }t
+t{ 0 GREC -> 0 }t
+t{ 1 GREC -> 0 1 }t
+t{ 2 GREC -> 0 1 2 }t
+t{ 3 GREC -> 0 1 2 3 }t
+t{ 4 GREC -> 0 1 2 3 4 }t
+
+TESTING POSTPONE REPEAT
+: POSTPONE-REPEAT
+ POSTPONE REPEAT ;
+
+t{ : PREP3 BEGIN DUP 5 < WHILE DUP 1+ [ POSTPONE-REPEAT ] ; -> }t
+t{ 0 PREP3 -> 0 1 2 3 4 5 }t
+t{ 4 PREP3 -> 4 5 }t
+t{ 5 PREP3 -> 5 }t
+t{ 6 PREP3 -> 6 }t
+
+t{ : PREP5 BEGIN DUP 2 > WHILE DUP 5 < WHILE DUP 1+ [ POSTPONE-REPEAT ] 123 ELSE 345 THEN ; -> }t
+t{ 1 PREP5 -> 1 345 }t
+t{ 2 PREP5 -> 2 345 }t
+t{ 3 PREP5 -> 3 4 5 123 }t
+t{ 4 PREP5 -> 4 5 123 }t
+t{ 5 PREP5 -> 5 123 }t
+
+TESTING POSTPONE S"
+: POSTPONE-S"
+ POSTPONE S" ;
+
+t{ : PSQ4 [ POSTPONE-S" XY" ] ; -> }t
+t{ PSQ4 SWAP DROP -> 2 }t
+t{ PSQ4 DROP DUP C@ SWAP CHAR+ C@ -> 58 59 }t
+
+TESTING POSTPONE THEN
+: POSTPONE-THEN
+ POSTPONE THEN ;
+
+t{ : PTH1 IF 123 [ POSTPONE-THEN ] ; -> }t
+t{ : PTH2 IF 123 ELSE 234 [ POSTPONE-THEN ] ; -> }t
+t{ 0 PTH1 -> }t
+t{ 1 PTH1 -> 123 }t
+t{ -1 PTH1 -> 123 }t
+t{ 0 PTH2 -> 234 }t
+t{ 1 PTH2 -> 123 }t
+t{ -1 PTH1 -> 123 }t
+
+t{ : PTH5 BEGIN DUP 2 > WHILE DUP 5 < WHILE DUP 1+ REPEAT 123 ELSE 345 [ POSTPONE-THEN ] ; -> }t
+t{ 1 PTH5 -> 1 345 }t
+t{ 2 PTH5 -> 2 345 }t
+t{ 3 PTH5 -> 3 4 5 123 }t
+t{ 4 PTH5 -> 4 5 123 }t
+t{ 5 PTH5 -> 5 123 }t
+
+t{ : PTH6 ( N -- 0,1,..N ) DUP IF DUP >R 1- RECURSE R> [ POSTPONE-THEN ] ; -> }t
+t{ 0 PTH6 -> 0 }t
+t{ 1 PTH6 -> 0 1 }t
+t{ 2 PTH6 -> 0 1 2 }t
+t{ 3 PTH6 -> 0 1 2 3 }t
+t{ 4 PTH6 -> 0 1 2 3 4 }t
+
+TESTING POSTPONE UNTIL
+: POSTPONE-UNTIL
+ POSTPONE UNTIL ;
+
+t{ : PUNT4 BEGIN DUP 1+ DUP 5 > [ POSTPONE-UNTIL ] ; -> }t
+t{ 3 PUNT4 -> 3 4 5 6 }t
+t{ 5 PUNT4 -> 5 6 }t
+t{ 6 PUNT4 -> 6 7 }t
+
+TESTING POSTPONE WHILE
+: POSTPONE-WHILE
+ POSTPONE WHILE ;
+
+t{ : PWH3 BEGIN DUP 5 < [ POSTPONE-WHILE ] DUP 1+ REPEAT ; -> }t
+t{ 0 PWH3 -> 0 1 2 3 4 5 }t
+t{ 4 PWH3 -> 4 5 }t
+t{ 5 PWH3 -> 5 }t
+t{ 6 PWH3 -> 6 }t
+
+t{ : PWH5 BEGIN DUP 2 > [ POSTPONE-WHILE ] DUP 5 < [ POSTPONE-WHILE ] DUP 1+ REPEAT 123 ELSE 345 THEN ; -> }t
+t{ 1 PWH5 -> 1 345 }t
+t{ 2 PWH5 -> 2 345 }t
+t{ 3 PWH5 -> 3 4 5 123 }t
+t{ 4 PWH5 -> 4 5 123 }t
+t{ 5 PWH5 -> 5 123 }t
+
+
+TESTING POSTPONE [
+: POSTPONE-[
+ POSTPONE [ ;
+
+t{ HERE POSTPONE-[ -> HERE }t
+
+TESTING POSTPONE [']
+: POSTPONE-[']
+ POSTPONE ['] ;
+
+t{ : PTICK1 123 ; -> }t
+t{ : PTICK2 [ POSTPONE-['] PTICK1 ] ; IMMEDIATE -> }t
+t{ PTICK2 EXECUTE -> 123 }t
+
+TESTING POSTPONE [CHAR]
+: POSTPONE-[CHAR]
+ POSTPONE [CHAR] ;
+
+t{ : PCHAR1 [ POSTPONE-[CHAR] X ] ; -> }t
+t{ : PCHAR2 [ POSTPONE-[CHAR] HELLO ] ; -> }t
+t{ PCHAR1 -> 58 }t
+t{ PCHAR2 -> 48 }t
+
diff --git a/amforth-6.5/common/lib/forth2012/tester/searchordertest.fth b/amforth-6.5/common/lib/forth2012/tester/searchordertest.fth
new file mode 100644
index 0000000..79f9de9
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/tester/searchordertest.fth
@@ -0,0 +1,178 @@
+\ To test the ANS Forth search-order word set and search order extensions
+
+\ This program was written by Gerry Jackson in 2006, with contributions from
+\ others where indicated, and is in the public domain - it can be distributed
+\ and/or modified in any way but please retain this notice.
+
+\ This program is distributed in the hope that it will be useful,
+\ but WITHOUT ANY WARRANTY; without even the implied warranty of
+\ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+\ The tests are not claimed to be comprehensive or correct
+
+\ ------------------------------------------------------------------------------
+\ Version 0.5 1 April 2012 Tests placed in the public domain.
+\ 0.4 6 March 2009 { and } replaced with T{ and }T
+\ 0.3 20 April 2007 ANS Forth words changed to upper case
+\ 0.2 30 Oct 2006 updated following GForth tests to get
+\ initial search order into a known state
+\ 0.1 Oct 2006 First version released
+
+\ ------------------------------------------------------------------------------
+\ The tests are based on John Hayes test program for the core word set
+\ and requires those files to have been loaded
+
+\ Words tested in this file are:
+\ FORTH-WORDLIST GET-ORDER SET-ORDER ALSO ONLY FORTH GET-CURRENT
+\ SET-CURRENT DEFINITIONS PREVIOUS SEARCH-WORDLIST WORDLIST FIND
+\ Words not fully tested:
+\ ORDER only tests that it executes, display is implementation
+\ dependent and should be visually inspected
+
+\ ------------------------------------------------------------------------------
+\ Assumptions and dependencies:
+\ - tester.fr or ttester.fs has been loaded prior to this file
+\ - that ONLY FORTH DEFINITIONS will work at the start of the file
+\ to ensure the search order is in a known state
+\ ------------------------------------------------------------------------------
+
+ONLY FORTH DEFINITIONS
+
+TESTING Search-order word set
+
+DECIMAL
+
+VARIABLE wid1 VARIABLE wid2
+
+: save-orderlist ( widn ... wid1 n -> ) DUP , 0 ?DO , LOOP ;
+
+\ ------------------------------------------------------------------------------
+TESTING FORTH-WORDLIST GET-ORDER SET-ORDER
+
+T{ FORTH-WORDLIST wid1 ! -> }T
+
+CREATE order-list
+
+T{ GET-ORDER save-orderlist -> }T
+
+: get-orderlist ( -- widn ... wid1 n )
+ order-list DUP @ CELLS ( -- ad n )
+ OVER + ( -- ad ad' )
+ ?DO I @ -1 CELLS +LOOP ( -- )
+;
+
+T{ GET-ORDER OVER -> GET-ORDER wid1 @ }T \ Forth wordlist at top
+T{ GET-ORDER SET-ORDER -> }T \ Effectively noop
+T{ GET-ORDER -> get-orderlist }T \ Check nothing changed
+T{ get-orderlist DROP get-orderlist 2* SET-ORDER -> }T
+T{ GET-ORDER -> get-orderlist DROP get-orderlist 2* }T
+T{ get-orderlist SET-ORDER GET-ORDER -> get-orderlist }T
+
+\ ------------------------------------------------------------------------------
+TESTING ALSO ONLY FORTH
+
+T{ ALSO GET-ORDER -> get-orderlist OVER SWAP 1+ }T
+T{ ONLY FORTH GET-ORDER -> get-orderlist }T \ See assumptions above
+
+\ ------------------------------------------------------------------------------
+TESTING GET-CURRENT SET-CURRENT WORDLIST (simple)
+
+T{ GET-CURRENT -> wid1 @ }T \ See assumptions above
+T{ WORDLIST wid2 ! -> }T
+T{ wid2 @ SET-CURRENT -> }T
+T{ GET-CURRENT -> wid2 @ }T
+T{ wid1 @ SET-CURRENT -> }T
+
+\ ------------------------------------------------------------------------------
+TESTING minimum search order list contains FORTH-WORDLIST and SET-ORDER
+
+: so1 SET-ORDER ; \ In case it is unavailable in the forth wordlist
+
+T{ ONLY FORTH-WORDLIST 1 SET-ORDER get-orderlist so1 -> }T
+T{ GET-ORDER -> get-orderlist }T
+
+\ ------------------------------------------------------------------------------
+TESTING GET-ORDER SET-ORDER with 0 and -1 number of wids argument
+
+: so2a GET-ORDER get-orderlist SET-ORDER ; \ To recover search order
+: so2 0 SET-ORDER so2a ;
+
+T{ so2 -> 0 }T \ 0 set-order leaves an empty search order
+
+: so3 -1 SET-ORDER so2a ;
+: so4 ONLY so2a ;
+
+T{ so3 -> so4 }T \ -1 SET-ORDER = ONLY
+
+\ ------------------------------------------------------------------------------
+TESTING DEFINITIONS PREVIOUS
+
+T{ ONLY FORTH DEFINITIONS -> }T
+T{ GET-CURRENT -> FORTH-WORDLIST }T
+T{ GET-ORDER wid2 @ SWAP 1+ SET-ORDER DEFINITIONS GET-CURRENT -> wid2 @ }T
+T{ GET-ORDER -> get-orderlist wid2 @ SWAP 1+ }T
+T{ PREVIOUS GET-ORDER -> get-orderlist }T
+T{ DEFINITIONS GET-CURRENT -> FORTH-WORDLIST }T
+
+\ ------------------------------------------------------------------------------
+TESTING SEARCH-WORDLIST WORDLIST FIND
+
+ONLY FORTH DEFINITIONS
+VARIABLE xt ' DUP xt !
+VARIABLE xti ' .( xti ! \ Immediate word
+
+T{ S" DUP" wid1 @ SEARCH-WORDLIST -> xt @ -1 }T
+T{ S" .(" wid1 @ SEARCH-WORDLIST -> xti @ 1 }T
+T{ S" DUP" wid2 @ SEARCH-WORDLIST -> 0 }T
+
+: c"dup" C" DUP" ;
+: c".(" C" .(" ;
+: c"x" C" unknown word" ;
+
+T{ c"dup" FIND -> xt @ -1 }T
+T{ c".(" FIND -> xti @ 1 }T
+T{ c"x" FIND -> c"x" 0 }T
+
+\ ------------------------------------------------------------------------------
+TESTING new definitions are put into the correct wordlist
+
+: alsowid2 ALSO GET-ORDER wid2 @ ROT DROP SWAP SET-ORDER ;
+alsowid2
+: w1 1234 ;
+DEFINITIONS
+: w1 -9876 ; IMMEDIATE
+
+ONLY FORTH
+T{ w1 -> 1234 }T
+DEFINITIONS
+T{ w1 -> 1234 }T
+alsowid2
+T{ w1 -> -9876 }T
+DEFINITIONS
+T{ w1 -> -9876 }T
+
+ONLY FORTH DEFINITIONS
+
+: so5 DUP IF SWAP EXECUTE THEN ;
+
+T{ S" w1" wid1 @ SEARCH-WORDLIST so5 -> -1 1234 }T
+T{ S" w1" wid2 @ SEARCH-WORDLIST so5 -> 1 -9876 }T
+
+: c"w1" C" w1" ;
+T{ alsowid2 c"w1" FIND so5 -> 1 -9876 }T
+T{ PREVIOUS c"w1" FIND so5 -> -1 1234 }T
+
+\ ------------------------------------------------------------------------------
+TESTING ORDER \ Should display search order and compilation wordlist
+
+CR .( ONLY FORTH DEFINITIONS search order and compilation list) CR
+T{ ONLY FORTH DEFINITIONS ORDER -> }T
+
+CR .( Plus another unnamed wordlist at the head of the search order) CR
+T{ alsowid2 DEFINITIONS ORDER -> }T
+
+\ ------------------------------------------------------------------------------
+
+CR .( End of Search Order word tests) CR
+
+ONLY FORTH DEFINITIONS \ Leave search order in the standard state
diff --git a/amforth-6.5/common/lib/forth2012/tester/searchordertest.txt b/amforth-6.5/common/lib/forth2012/tester/searchordertest.txt
new file mode 100644
index 0000000..9018a5d
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/tester/searchordertest.txt
@@ -0,0 +1,184 @@
+\ To test the ANS Forth search-order word set and search order extensions
+
+\ Copyright (C) Gerry Jackson 2006
+
+\ This program is free software; you can redistribute it and/or
+\ modify it any way.
+
+\ This program is distributed in the hope that it will be useful,
+\ but WITHOUT ANY WARRANTY; without even the implied warranty of
+\ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+\ The tests are not claimed to be comprehensive or correct
+
+\ --------------------------------------------------------------------
+\ Version 0.1 Oct 2006 First version released
+
+\ --------------------------------------------------------------------
+\ The tests are based on John Hayes test program for the core word set
+\ and requires those files to have been loaded
+
+\ Words tested in this file are:
+\ forth-wordlist get-order set-order also only forth get-current
+\ set-current definitions previous search-wordlist wordlist find
+\ Words not fully tested:
+\ order only tests that it executes, display is implementation
+\ dependent
+
+\ --------------------------------------------------------------------
+\ Assumptions and dependencies:
+\ - running on a case insensitive system. Strictly speaking ANS
+\ Forth words should be in upper case only, this file is mostly
+\ lower case
+\ - the forth wordlist is at the head of the search order and is
+\ also the compilation wordlist
+\ - tester.fr has been loaded prior to this file
+\ --------------------------------------------------------------------
+
+Testing Search-order word set
+
+decimal
+
+variable wid1 variable wid2
+
+: save-orderlist ( widn ... wid1 n -> ) dup , 0 ?do , loop ;
+
+\ --------------------------------------------------------------------
+
+Testing forth-wordlist get-order set-order
+
+{ forth-wordlist wid1 ! -> }
+
+create order-list
+
+{ get-order save-orderlist -> }
+
+: get-orderlist ( -- widn ... wid1 n )
+ order-list dup @ cells ( -- ad n )
+ over + ( -- ad ad' )
+ ?do i @ -1 cells +loop ( -- )
+;
+
+{ get-order over -> get-order wid1 @ } \ Forth wordlist at top
+{ get-order set-order -> } \ Effectively noop
+{ get-order -> get-orderlist } \ Check nothing changed
+{ get-orderlist drop get-orderList 2* set-order -> }
+{ get-order -> get-orderlist drop get-orderList 2* }
+{ get-orderlist set-order get-order -> get-orderlist }
+
+\ --------------------------------------------------------------------
+
+Testing also only forth
+
+{ also get-order -> get-orderlist over swap 1+ }
+{ only forth get-order -> get-orderlist } \ See assumptions above
+
+\ --------------------------------------------------------------------
+
+Testing get-current set-current wordlist (simple)
+
+{ get-current -> wid1 @ } \ See assumptions above
+{ wordlist wid2 ! -> }
+{ wid2 @ set-current -> }
+{ get-current -> wid2 @ }
+{ wid1 @ set-current
+
+\ --------------------------------------------------------------------
+
+Testing minimum search order list contains forth-wordlist and set-order
+
+: so1 set-order ; \ In case it is unavailable in the forth wordlist
+
+{ only forth-wordlist 1 set-order get-orderlist so1 -> }
+{ get-order -> get-orderlist }
+
+\ --------------------------------------------------------------------
+
+Testing get-order set-order with 0 and -1 number of wids argument
+
+: so2a get-order get-orderlist set-order ; \ To recover search order
+: so2 0 set-order so2a ;
+
+{ so2 -> 0 } \ 0 set-order leaves an empty search order
+
+: so3 -1 set-order so2a ;
+: so4 only so2a ;
+
+{ so3 -> so4 } \ -1 set-order = only
+
+\ --------------------------------------------------------------------
+
+Testing definitions previous
+
+{ only forth definitions -> }
+{ get-current -> forth-wordlist }
+{ get-order wid2 @ swap 1+ set-order definitions get-current -> wid2 @ }
+{ get-order -> get-orderlist wid2 @ swap 1+ }
+{ previous get-order -> get-orderlist }
+{ definitions get-current -> forth-wordlist }
+
+\ --------------------------------------------------------------------
+
+Testing search-wordlist wordlist find
+
+only forth definitions
+variable xt ' dup xt !
+variable xti ' .( xti ! \ Immediate word
+
+{ s" dup" wid1 @ search-wordlist -> xt @ -1 }
+{ s" .(" wid1 @ search-wordlist -> xti @ 1 }
+{ s" dup" wid2 @ search-wordlist -> 0 }
+
+: c"dup" c" dup" ;
+: c".(" c" .(" ;
+: c"x" c" unknown word" ;
+
+{ c"dup" find -> xt @ -1 }
+{ c".(" find -> xti @ 1 }
+{ c"x" find -> c"x" 0 }
+
+\ --------------------------------------------------------------------
+
+Testing new definitions are put into the correct wordlist
+
+: alsowid2 also get-order wid2 @ rot drop swap set-order ;
+alsowid2
+: w1 1234 ;
+definitions
+: w1 -9876 ; immediate
+
+only forth
+{ w1 -> 1234 }
+definitions
+{ w1 -> 1234 }
+alsowid2
+{ w1 -> -9876 }
+definitions
+{ w1 -> -9876 }
+
+only forth definitions
+
+: so5 dup if swap execute then ;
+
+{ s" w1" wid1 @ search-wordlist so5 -> -1 1234 }
+{ s" w1" wid2 @ search-wordlist so5 -> 1 -9876 }
+
+: c"w1" c" w1" ;
+{ alsowid2 c"w1" find so5 -> 1 -9876 }
+{ previous c"w1" find so5 -> -1 1234 }
+
+\ --------------------------------------------------------------------
+
+Testing order \ Should display search order and compilation wordlist
+
+cr .( ONLY FORTH DEFINITIONS search order and compilation list) cr
+{ only forth definitions order -> }
+
+cr .( Plus another unnamed wordlist at the head of the search order) cr
+{ alsowid2 definitions order -> }
+
+\ --------------------------------------------------------------------
+
+cr .( Tests on Search Order words completed successfully) cr
+
+only forth definitions \ Leave search order in the standard state
diff --git a/amforth-6.5/common/lib/forth2012/tester/stringtest.fth b/amforth-6.5/common/lib/forth2012/tester/stringtest.fth
new file mode 100644
index 0000000..95e2bfe
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/tester/stringtest.fth
@@ -0,0 +1,161 @@
+\ To test the ANS Forth String word set
+
+\ This program was written by Gerry Jackson in 2006, with contributions from
+\ others where indicated, and is in the public domain - it can be distributed
+\ and/or modified in any way but please retain this notice.
+
+\ This program is distributed in the hope that it will be useful,
+\ but WITHOUT ANY WARRANTY; without even the implied warranty of
+\ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+\ The tests are not claimed to be comprehensive or correct
+
+\ ------------------------------------------------------------------------------
+\ Version 0.6 1 April 2012 Tests placed in the public domain.
+\ 0.5 29 April 2010 Added tests for SEARCH and COMPARE with
+\ all strings zero length (suggested by Krishna Myneni).
+\ SLITERAL test amended in line with comp.lang.forth
+\ discussion
+\ 0.4 30 November 2009 <true> and <false> replaced with TRUE
+\ and FALSE
+\ 0.3 6 March 2009 { and } replaced with T{ and }T
+\ 0.2 20 April 2007 ANS Forth words changed to upper case
+\ 0.1 Oct 2006 First version released
+
+\ ------------------------------------------------------------------------------
+\ The tests are based on John Hayes test program for the core word set
+\ and requires those files to have been loaded
+
+\ Words tested in this file are:
+\ -TRAILING /STRING BLANK CMOVE CMOVE> COMPARE SEARCH SLITERAL
+\
+\ ------------------------------------------------------------------------------
+\ Assumptions and dependencies:
+\ - tester.fr or ttester.fs has been loaded prior to this file
+\ - COMPARE is case sensitive
+\ ------------------------------------------------------------------------------
+
+TESTING String word set
+
+DECIMAL
+
+T{ : s1 S" abcdefghijklmnopqrstuvwxyz" ; -> }T
+T{ : s2 S" abc" ; -> }T
+T{ : s3 S" jklmn" ; -> }T
+T{ : s4 S" z" ; -> }T
+T{ : s5 S" mnoq" ; -> }T
+T{ : s6 S" 12345" ; -> }T
+T{ : s7 S" " ; -> }T
+T{ : s8 S" abc " ; -> }T
+T{ : s9 S" " ; -> }T
+T{ : s10 S" a " ; -> }T
+
+\ ------------------------------------------------------------------------------
+TESTING -TRAILING
+
+T{ s1 -TRAILING -> s1 }T
+T{ s8 -TRAILING -> s8 2 - }T
+T{ s7 -TRAILING -> s7 }T
+T{ s9 -TRAILING -> s9 DROP 0 }T
+T{ s10 -TRAILING -> s10 1- }T
+
+\ ------------------------------------------------------------------------------
+TESTING /STRING
+
+T{ s1 5 /STRING -> s1 SWAP 5 + SWAP 5 - }T
+T{ s1 10 /STRING -4 /STRING -> s1 6 /STRING }T
+T{ s1 0 /STRING -> s1 }T
+
+\ ------------------------------------------------------------------------------
+TESTING SEARCH
+
+T{ s1 s2 SEARCH -> s1 TRUE }T
+T{ s1 s3 SEARCH -> s1 9 /STRING TRUE }T
+T{ s1 s4 SEARCH -> s1 25 /STRING TRUE }T
+T{ s1 s5 SEARCH -> s1 FALSE }T
+T{ s1 s6 SEARCH -> s1 FALSE }T
+T{ s1 s7 SEARCH -> s1 TRUE }T
+T{ s7 PAD 0 SEARCH -> s7 TRUE }T
+
+\ ------------------------------------------------------------------------------
+TESTING COMPARE
+
+T{ s1 s1 COMPARE -> 0 }T
+T{ s1 PAD SWAP CMOVE -> }T
+T{ s1 PAD OVER COMPARE -> 0 }T
+T{ s1 PAD 6 COMPARE -> 1 }T
+T{ PAD 10 s1 COMPARE -> -1 }T
+T{ s1 PAD 0 COMPARE -> 1 }T
+T{ PAD 0 s1 COMPARE -> -1 }T
+T{ s1 s6 COMPARE -> 1 }T
+T{ s6 s1 COMPARE -> -1 }T
+T{ s7 PAD 0 COMPARE -> 0 }T
+
+: "abdde" S" abdde" ;
+: "abbde" S" abbde" ;
+: "abcdf" S" abcdf" ;
+: "abcdee" S" abcdee" ;
+
+T{ s1 "abdde" COMPARE -> -1 }T
+T{ s1 "abbde" COMPARE -> 1 }T
+T{ s1 "abcdf" COMPARE -> -1 }T
+T{ s1 "abcdee" COMPARE -> 1 }T
+
+: s11 S" 0abc" ;
+: s12 S" 0aBc" ;
+
+T{ s11 s12 COMPARE -> 1 }T
+T{ s12 s11 COMPARE -> -1 }T
+
+\ ------------------------------------------------------------------------------
+TESTING CMOVE and CMOVE>
+
+PAD 30 CHARS 0 FILL
+T{ s1 PAD SWAP CMOVE -> }T
+T{ s1 PAD s1 SWAP DROP COMPARE -> 0 }T
+T{ s6 PAD 10 CHARS + SWAP CMOVE -> }T
+T{ S" abcdefghij12345pqrstuvwxyz" PAD s1 SWAP DROP COMPARE -> 0 }T
+T{ PAD 15 CHARS + PAD CHAR+ 6 CMOVE -> }T
+T{ S" apqrstuhij12345pqrstuvwxyz" PAD 26 COMPARE -> 0 }T
+T{ PAD PAD 3 CHARS + 7 CMOVE -> }T
+T{ S" apqapqapqa12345pqrstuvwxyz" PAD 26 COMPARE -> 0 }T
+T{ PAD PAD CHAR+ 10 CMOVE -> }T
+T{ S" aaaaaaaaaaa2345pqrstuvwxyz" PAD 26 COMPARE -> 0 }T
+T{ s7 PAD 14 CHARS + SWAP CMOVE -> }T
+T{ S" aaaaaaaaaaa2345pqrstuvwxyz" PAD 26 COMPARE -> 0 }T
+
+PAD 30 CHARS 0 FILL
+
+T{ s1 PAD SWAP CMOVE> -> }T
+T{ s1 PAD s1 SWAP DROP COMPARE -> 0 }T
+T{ s6 PAD 10 CHARS + SWAP CMOVE> -> }T
+T{ S" abcdefghij12345pqrstuvwxyz" PAD s1 SWAP DROP COMPARE -> 0 }T
+T{ PAD 15 CHARS + PAD CHAR+ 6 CMOVE> -> }T
+T{ S" apqrstuhij12345pqrstuvwxyz" PAD 26 COMPARE -> 0 }T
+T{ PAD 13 CHARS + PAD 10 CHARS + 7 CMOVE> -> }T
+T{ S" apqrstuhijtrstrstrstuvwxyz" PAD 26 COMPARE -> 0 }T
+T{ PAD 12 CHARS + PAD 11 CHARS + 10 CMOVE> -> }T
+T{ S" apqrstuhijtvvvvvvvvvvvwxyz" PAD 26 COMPARE -> 0 }T
+T{ s7 PAD 14 CHARS + SWAP CMOVE> -> }T
+T{ S" apqrstuhijtvvvvvvvvvvvwxyz" PAD 26 COMPARE -> 0 }T
+
+\ ------------------------------------------------------------------------------
+TESTING BLANK
+
+: s13 S" aaaaa a" ; \ Don't move this down or might corrupt PAD
+
+T{ PAD 25 CHAR a FILL -> }T
+T{ PAD 5 CHARS + 6 BLANK -> }T
+T{ PAD 12 s13 COMPARE -> 0 }T
+
+\ ------------------------------------------------------------------------------
+TESTING SLITERAL
+
+T{ HERE DUP s1 DUP ALLOT ROT SWAP CMOVE s1 SWAP DROP 2CONSTANT s1a -> }T
+T{ : s14 [ s1a ] SLITERAL ; -> }T
+T{ s1a s14 COMPARE -> 0 }T
+T{ s1a DROP s14 DROP = -> FALSE }T
+
+\ ------------------------------------------------------------------------------
+
+CR .( End of String word tests) CR
diff --git a/amforth-6.5/common/lib/forth2012/tester/tester-amforth.frt b/amforth-6.5/common/lib/forth2012/tester/tester-amforth.frt
new file mode 100644
index 0000000..01d3ca5
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/tester/tester-amforth.frt
@@ -0,0 +1,66 @@
+\ From: John Hayes S1I
+\ Subject: tester.fr
+\ Date: Mon, 27 Nov 95 13:10:09 PST
+
+\ (C) 1995 JOHNS HOPKINS UNIVERSITY / APPLIED PHYSICS LABORATORY
+\ MAY BE DISTRIBUTED FREELY AS LONG AS THIS COPYRIGHT NOTICE REMAINS.
+\ VERSION 1.1
+
+\ modified for amforth by Matthias Trute 2007
+
+\ SET THE FOLLOWING FLAG TO TRUE FOR MORE VERBOSE OUTPUT; THIS MAY
+\ ALLOW YOU TO TELL WHICH TEST CAUSED YOUR SYSTEM TO HANG.
+variable VERBOSE
+ 0 VERBOSE !
+
+variable ACTUAL-DEPTH \ STACK RECORD
+variable START-DEPTH
+
+: EMPTY-STACK \ ( ... -- ) EMPTY STACK: HANDLES UNDERFLOWED STACK TOO.
+ depth START-DEPTH @ < if
+ depth START-DEPTH @ swap do 0 loop
+ then
+ depth START-DEPTH @ > if
+ depth START-DEPTH @ do drop loop
+ then
+;
+
+: ERROR \ ( C-ADDR U -- ) DISPLAY AN ERROR MESSAGE FOLLOWED BY
+ \ THE LINE THAT HAD THE ERROR.
+ itype source type cr \ DISPLAY LINE CORRESPONDING TO ERROR
+ EMPTY-STACK \ THROW AWAY EVERY THING ELSE
+;
+
+variable ACTUAL-DEPTH \ STACK RECORD
+variable ACTUAL-RESULTS 20 cells allot \ reserve space in RAM
+
+: t{ \ ( -- ) SYNTACTIC SUGAR.
+ depth START-DEPTH !
+;
+
+: -> \ ( ... -- ) RECORD DEPTH AND CONTENT OF STACK.
+ depth dup ACTUAL-DEPTH ! \ RECORD DEPTH
+ START-DEPTH @ > if \ IF THERE IS SOMETHING ON STACK
+ depth START-DEPTH @ - 0 do ACTUAL-RESULTS i cells + ! loop \ SAVE THEM
+ then
+;
+
+: }t \ ( ... -- ) COMPARE STACK (EXPECTED) CONTENTS WITH SAVED
+ depth ACTUAL-DEPTH @ = if \ IF DEPTHS MATCH
+ depth START-DEPTH @ > if \ IF THERE IS SOMETHING ON THE STACK
+ depth START-DEPTH @ - 0 do \ FOR EACH STACK ITEM
+ ACTUAL-RESULTS i cells + @ \ COMPARE ACTUAL WITH EXPECTED
+ <> if s" INCORRECT RESULT: " ERROR leave then
+ loop
+ then
+ else \ DEPTH MISMATCH
+ s" WRONG NUMBER OF RESULTS: " ERROR
+ then
+;
+
+: TESTING \ ( -- ) TALKING COMMENT.
+ source VERBOSE @
+ if dup >r type cr r> >in !
+ else >in ! drop
+ then ;
+
diff --git a/amforth-6.5/common/lib/forth2012/tester/toolstest.fth b/amforth-6.5/common/lib/forth2012/tester/toolstest.fth
new file mode 100644
index 0000000..a35450b
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/tester/toolstest.fth
@@ -0,0 +1,172 @@
+\ To test some of the ANS Forth Programming Tools and extension wordset
+
+\ This program was written by Gerry Jackson in 2006, with contributions from
+\ others where indicated, and is in the public domain - it can be distributed
+\ and/or modified in any way but please retain this notice.
+
+\ This program is distributed in the hope that it will be useful,
+\ but WITHOUT ANY WARRANTY; without even the implied warranty of
+\ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+\ The tests are not claimed to be comprehensive or correct
+
+\ ------------------------------------------------------------------------------
+\ Version 0.6 1 April 2012 Tests placed in the public domain.
+\ Further tests on [IF] [ELSE] [THEN]
+\ 0.5 30 November 2009 <true> and <false> replaced with TRUE and FALSE
+\ 0.4 6 March 2009 ENDIF changed to THEN. {...} changed to T{...}T
+\ 0.3 20 April 2007 ANS Forth words changed to upper case
+\ 0.2 30 Oct 2006 updated following GForth test to avoid
+\ changing stack depth during a colon definition
+\ 0.1 Oct 2006 First version released
+
+\ ------------------------------------------------------------------------------
+\ The tests are based on John Hayes test program
+
+\ Words tested in this file are:
+\ AHEAD [IF] [ELSE] [THEN] CS-PICK CS-ROLL
+\
+
+\ Words not tested:
+\ .S ? DUMP SEE WORDS
+\ ;CODE ASSEMBLER BYE CODE EDITOR FORGET STATE
+\ ------------------------------------------------------------------------------
+\ Assumptions and dependencies:
+\ - tester.fr or ttester.fs has been loaded prior to this file
+\ ------------------------------------------------------------------------------
+
+DECIMAL
+
+\ ------------------------------------------------------------------------------
+TESTING AHEAD
+
+T{ : pt1 AHEAD 1111 2222 THEN 3333 ; -> }T
+T{ pt1 -> 3333 }T
+
+\ ------------------------------------------------------------------------------
+TESTING [IF] [ELSE] [THEN]
+
+T{ TRUE [IF] 111 [ELSE] 222 [THEN] -> 111 }T
+T{ FALSE [IF] 111 [ELSE] 222 [THEN] -> 222 }T
+
+T{ TRUE [IF] 1 \ Code spread over more than 1 line
+ 2
+ [ELSE]
+ 3
+ 4
+ [THEN] -> 1 2 }T
+T{ FALSE [IF]
+ 1 2
+ [ELSE]
+ 3 4
+ [THEN] -> 3 4 }T
+
+T{ TRUE [IF] 1 TRUE [IF] 2 [ELSE] 3 [THEN] [ELSE] 4 [THEN] -> 1 2 }T
+T{ FALSE [IF] 1 TRUE [IF] 2 [ELSE] 3 [THEN] [ELSE] 4 [THEN] -> 4 }T
+T{ TRUE [IF] 1 FALSE [IF] 2 [ELSE] 3 [THEN] [ELSE] 4 [THEN] -> 1 3 }T
+T{ FALSE [IF] 1 FALSE [IF] 2 [ELSE] 3 [THEN] [ELSE] 4 [THEN] -> 4 }T
+
+\ ------------------------------------------------------------------------------
+TESTING immediacy of [IF] [ELSE] [THEN]
+
+T{ : pt2 [ 0 ] [IF] 1111 [ELSE] 2222 [THEN] ; pt2 -> 2222 }T
+T{ : pt3 [ -1 ] [IF] 3333 [ELSE] 4444 [THEN] ; pt3 -> 3333 }T
+: pt9 bl WORD FIND ;
+T{ pt9 [IF] NIP -> 1 }T
+T{ pt9 [ELSE] NIP -> 1 }T
+T{ pt9 [THEN] NIP -> 1 }T
+
+\ -----------------------------------------------------------------------------
+TESTING [IF] and [ELSE] carry out a text scan by parsing and discarding words
+\ so that an [ELSE] or [THEN] in a comment or string is recognised
+
+: pt10 REFILL DROP REFILL DROP ;
+
+T{ 0 [IF] \ Words ignored up to [ELSE] 2
+ [THEN] -> 2 }T
+T{ -1 [IF] 2 [ELSE] 3 s" [THEN] 4 pt10 ignored to end of line"
+ [THEN] \ Precaution in case [THEN] in string isn't recognised
+ -> 2 4 }T
+
+\ ------------------------------------------------------------------------------
+TESTING CS-PICK and CS-ROLL
+
+\ Test pt5 based on example in ANS document p 176.
+
+: ?repeat
+ 0 CS-PICK POSTPONE UNTIL
+; IMMEDIATE
+
+VARIABLE pt4
+
+T{ : pt5 ( n1 -- )
+ pt4 !
+ BEGIN
+ -1 pt4 +!
+ pt4 @ 4 > 0= ?repeat \ Back to BEGIN if false
+ 111
+ pt4 @ 3 > 0= ?repeat
+ 222
+ pt4 @ 2 > 0= ?repeat
+ 333
+ pt4 @ 1 =
+ UNTIL
+; -> }T
+
+T{ 6 pt5 -> 111 111 222 111 222 333 111 222 333 }T
+
+
+T{ : ?DONE POSTPONE IF 1 CS-ROLL ; IMMEDIATE -> }T \ Same as WHILE
+T{ : pt6
+ >R
+ BEGIN
+ R@
+ ?DONE
+ R@
+ R> 1- >R
+ REPEAT
+ R> DROP
+ ; -> }T
+
+T{ 5 pt6 -> 5 4 3 2 1 }T
+
+: mix_up 2 CS-ROLL ; IMMEDIATE \ cs-rot
+
+: pt7 ( f3 f2 f1 -- ? )
+ IF 1111 ROT ROT ( -- 1111 f3 f2 ) ( cs: -- orig1 )
+ IF 2222 SWAP ( -- 1111 2222 f3 ) ( cs: -- orig1 orig2 )
+ IF ( cs: -- orig1 orig2 orig3 )
+ 3333 mix_up ( -- 1111 2222 3333 ) ( cs: -- orig2 orig3 orig1 )
+ THEN ( cs: -- orig2 orig3 )
+ 4444 \ Hence failure of first IF comes here and falls through
+ THEN ( cs: -- orig2 )
+ 5555 \ Failure of 3rd IF comes here
+ THEN ( cs: -- )
+ 6666 \ Failure of 2nd IF comes here
+;
+
+T{ -1 -1 -1 pt7 -> 1111 2222 3333 4444 5555 6666 }T
+T{ 0 -1 -1 pt7 -> 1111 2222 5555 6666 }T
+T{ 0 0 -1 pt7 -> 1111 0 6666 }T
+T{ 0 0 0 pt7 -> 0 0 4444 5555 6666 }T
+
+: [1cs-roll] 1 CS-ROLL ; IMMEDIATE
+
+T{ : pt8
+ >R
+ AHEAD 111
+ BEGIN 222
+ [1cs-roll]
+ THEN
+ 333
+ R> 1- >R
+ R@ 0<
+ UNTIL
+ R> DROP
+ ; -> }T
+
+T{ 1 pt8 -> 333 222 333 }T
+
+\ ------------------------------------------------------------------------------
+
+CR .( End of Programming Tools word tests) CR
diff --git a/amforth-6.5/common/lib/forth2012/tools.frt b/amforth-6.5/common/lib/forth2012/tools.frt
new file mode 100644
index 0000000..fdc8f08
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/tools.frt
@@ -0,0 +1,6 @@
+\ 'tools.frt' generated automatically, do not edit
+#include defined.frt
+#include dot-s.frt
+#include dumper.frt
+#include dump.frt
+#include question.frt
diff --git a/amforth-6.5/common/lib/forth2012/tools/bracket-conditional.frt b/amforth-6.5/common/lib/forth2012/tools/bracket-conditional.frt
new file mode 100644
index 0000000..5df8c28
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/tools/bracket-conditional.frt
@@ -0,0 +1,20 @@
+
+: [else] \ ( -- )
+ begin
+ begin
+ parse-name
+ dup
+ while
+ 2dup s" [else]" icompare
+ ?dup 0=
+ if exit then
+ repeat 2drop
+ refill 0=
+ until
+; immediate
+
+: [if] \ ( flag -- )
+ 0= if postpone [else] then
+; immediate
+
+: [then] ; immediate
diff --git a/amforth-6.5/common/lib/forth2012/tools/defined.frt b/amforth-6.5/common/lib/forth2012/tools/defined.frt
new file mode 100644
index 0000000..cef7e78
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/tools/defined.frt
@@ -0,0 +1,10 @@
+
+\ http://www.forth200x.org/defined.html
+\ adapted to non-counted strings
+
+: [defined] parse-name find-name dup if swap drop then ; immediate
+: [undefined] postpone [defined] 0= ; immediate
+
+\ ... and without postpone (Enoch, Feb-2013)
+\ : [defined] parse-name find-name if drop -1 else 0 then ; immediate
+\ : [undefined] parse-name find-name if drop 0 else -1 then ; immediate
diff --git a/amforth-6.5/common/lib/forth2012/tools/dot-s.frt b/amforth-6.5/common/lib/forth2012/tools/dot-s.frt
new file mode 100644
index 0000000..1c86dd8
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/tools/dot-s.frt
@@ -0,0 +1,3 @@
+
+\ a .s with the TOS printed *last*
+: .s depth 0 ?do depth i - 1- pick . loop ; \ No newline at end of file
diff --git a/amforth-6.5/common/lib/forth2012/tools/dump.frt b/amforth-6.5/common/lib/forth2012/tools/dump.frt
new file mode 100644
index 0000000..fba47d7
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/tools/dump.frt
@@ -0,0 +1,50 @@
+
+\ dump memories
+\ usage is
+\ addr len [ei]dump
+\ output looks like (for word oriented memories)
+\ (ATmega32)> 0 10 edump
+\ 0000 - FFFF D9FF 17D9 2117 0121 5201 0052 DE00 .......!!..RR...
+\ 0008 - 0CDE 6F0C 3B6F 193B 0019 3200 0B32 140B ...oo;;....22...
+
+\ RAM dump is byte oriented:
+\ 00B0 BD 3E 55 33 5B E6 C4 9B 4A 63 72 20 63 72 20 24 .>U3[...Jcr.cr.$
+\ 00C0 62 30 20 32 30 20 64 75 6D 70 20 63 72 20 63 72 b0.20.dump.cr.cr
+
+hex
+
+: ?ascii ( char -- printable-char )
+ dup 20 < if drop 2e
+ else dup 7e >
+ if drop 2e then
+ then ;
+
+: .2hex s>d <# # # #> type ;
+: .4hex s>d <# # # # # #> type ;
+
+: dump ( addr count -- )
+ cr 0
+ do dup .4hex space
+ 10 0 do dup i + c@ .2hex space loop 2 spaces
+ 10 0 do dup i + c@ ?ascii emit loop
+ 10 + cr
+ 10 +loop drop ;
+
+: split ( n - c c ) dup $ff and swap $ff00 and $100 / $ff and swap ;
+
+: idump ( addr count -- )
+ cr 0
+ do dup .4hex space [char] - emit space
+ 8 0 do dup i + @i .4hex space loop 2 spaces
+ 8 0 do dup i + @i split ?ascii emit ?ascii emit loop
+ 8 + cr
+ 8 +loop drop ;
+
+: edump ( addr count -- )
+ cr 0
+ do dup .4hex space [char] - emit space
+ 08 0 do dup i cells + @e .4hex space loop 2 spaces
+ 08 0 do dup i cells + @e split ?ascii emit ?ascii emit loop
+ 10 + cr
+ 10 +loop drop ;
+
diff --git a/amforth-6.5/common/lib/forth2012/tools/dumper.frt b/amforth-6.5/common/lib/forth2012/tools/dumper.frt
new file mode 100644
index 0000000..fdb1c09
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/tools/dumper.frt
@@ -0,0 +1,57 @@
+\ dump cells from addr upward for len. mk03.10.2008
+
+\ We want xdump ( addr len -- ) doing output like this:
+\ xxx0 cccc cccc cccc cccc cccc cccc cccc cccc
+\ xxx8 cccc cccc cccc cccc cccc cccc cccc cccc
+\ ...
+
+\ That is, we alway print 8 cells. And want to see them in segments of 8 cells,
+\ all starting at xxx0 or xxx8 addresses.
+\ So we have to trimm addr and len first:
+\ Clear lower 3 bits of addr, then set lower 3 bits of len
+\ The rest shoud be obvious.
+
+hex
+
+\ helper word
+\ print a number in a field with 0 filled
+: u.r ( u w -- )
+ >r 0 \ see u.
+ <#
+ r> 0 ?do # loop
+ #>
+ type
+;
+
+( item -- )
+: .item 4 u.r space ;
+
+( addr -- )
+: i? @i .item ;
+: e? @e .item ;
+: ? @ .item ;
+
+( addr n -- addr+n )
+: .icells 0 do dup i? 1+ loop ; \ flash
+: .ecells 0 do dup e? cell+ loop ; \ eeprom
+: .rcells 0 do dup ? cell+ loop ; \ ram
+
+( addr -- )
+: .addr cr .item space ;
+
+( addr1 len1 -- addr2 len2 )
+: trimm swap fff8 and swap 7 or ;
+
+( adr len -- )
+: <dump postpone trimm postpone 0 postpone ?do postpone dup
+ postpone .addr 8 postpone literal ; immediate
+
+( n -- )
+: dump> postpone +loop postpone drop ; immediate
+
+( addr len -- )
+: idump <dump .icells 8 dump> ;
+: edump <dump .ecells 10 dump> ;
+: dump <dump .rcells 10 dump> ;
+
+\ finis tested ok on amforth-2.9 05.10.2008 mk
diff --git a/amforth-6.5/common/lib/forth2012/tools/name2compile.frt b/amforth-6.5/common/lib/forth2012/tools/name2compile.frt
new file mode 100644
index 0000000..fa50d2b
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/tools/name2compile.frt
@@ -0,0 +1,9 @@
+
+: name>compile ( nt -- xt1 xt2)
+ dup nfa>cfa swap name>flags immediate? 1 = if
+ ['] execute
+ else
+ ['] ,
+ then
+;
+
diff --git a/amforth-6.5/common/lib/forth2012/tools/name2interpret.frt b/amforth-6.5/common/lib/forth2012/tools/name2interpret.frt
new file mode 100644
index 0000000..417980a
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/tools/name2interpret.frt
@@ -0,0 +1,4 @@
+
+: name>interpret ( nt -- xt )
+ nfa>cfa
+;
diff --git a/amforth-6.5/common/lib/forth2012/tools/question.frt b/amforth-6.5/common/lib/forth2012/tools/question.frt
new file mode 100644
index 0000000..bd96e6c
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/tools/question.frt
@@ -0,0 +1,4 @@
+
+\ displays the value of the given address with current base
+: ? ( addr -- )
+ @ . ;
diff --git a/amforth-6.5/common/lib/forth2012/tools/see.frt b/amforth-6.5/common/lib/forth2012/tools/see.frt
new file mode 100644
index 0000000..5b5fda5
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/tools/see.frt
@@ -0,0 +1,56 @@
+hex
+\ decompiler
+
+\ marker --see--
+
+: .name ( nfa -- ) \ Namensfeld ausgeben
+ icount $ff and dup 15 < if itype else drop drop ." :noname" then ;
+
+' exit constant exitxt \ Adresse des xt zu "exit" speichern
+' cr @i constant docolxt \ Adresse des Forth-DOCOLON VM Interpreter
+' cr 1+ @i constant litxt \ Adresse des xt zu "(lit)" speichern
+' bl @i constant dovarxt \ Adresse des xt zu "VARIABLE"
+' base @i constant douser \ Adresse des xt zu "USER"
+' emit @i constant dodefer \
+' s" 9 + @i constant doslit \ Adresse des xt zu "(slit)" speichern
+' if 2 + @i constant do0branch \ Adresse des xt zu "0branch" speichern
+' else 2 + @i constant dobranch \ Adresse des xt zu "branch" speichern
+' loop 2 + @i constant doloop \ Adresse des xt zu "(loop)" speichern
+' +loop 2 + @i constant do+loop \ Adresse des xt zu "(+loop)" speichern
+' do 2 + @i constant dodo \ Adresse des xt zu "(do)" speichern
+' ?do 2 + @i constant doqdo \ Adresse des xt zu "(?do)" speichern
+
+: see ( "<spaces>name" -- ) \ decompiler
+ parse-name find-name if
+ dup @i over - 1 = if dup >name .name space ." is a primitive" then
+ dup @i dovarxt = if ." variable " 1+ dup @i . then
+ dup @i douser = if ." user " 1+ dup @i . then
+ dup @i dodefer = if ." defer " then
+ dup @i docolxt = if
+ [char] : emit space dup >name .name
+ begin
+ cr [char] [ emit space dup u. [char] ] emit space 2 spaces
+ 1+ dup @i dup 4 .r space ( get next xt )
+ dup litxt = if drop 1+ dup @i . 0 then
+ dup exitxt = if drop [char] ; emit 1 then
+ dup doslit = if
+ drop [char] . emit [char] " emit space 1+ dup .name [char] " emit
+ dup @i $FF and 2/ 2 + + 0
+ then
+ dup do0branch = if drop ." 0branch -> " 1+ dup @i 1- u. 0 then
+ dup dobranch = if drop ." branch -> " 1+ dup @i 1- u. 0 then
+ dup dodo = if drop ." do -> " 1+ dup @i 1- u. 0 then
+ dup doqdo = if drop ." ?do -> " 1+ dup @i 1- u. 0 then
+ dup doloop = if drop ." loop -> " 1+ dup @i 1- u. 0 then
+ dup do+loop = if drop ." +loop -> " 1+ dup @i 1- u. 0 then
+ dup 1 > if dup >name .name then
+ 1 =
+ until then
+ drop
+ else
+ ." not found"
+ then
+;
+
+\ Beispiel:
+\ ' see see
diff --git a/amforth-6.5/common/lib/forth2012/tools/synonym.frt b/amforth-6.5/common/lib/forth2012/tools/synonym.frt
new file mode 100644
index 0000000..bb51c61
--- /dev/null
+++ b/amforth-6.5/common/lib/forth2012/tools/synonym.frt
@@ -0,0 +1,12 @@
+\ SYNONYM <newname> <oldname>
+
+\
+\ does not check for reference to itself
+\
+: synonym
+ create immediate ' ,
+ does>
+ @i state @ if , else execute then
+;
+
+\ : synonym : bl word find >r compile, postpone ; r> 0> IF immedate THEN ; \ No newline at end of file