From 572a79b4c724d4c6c7770874bafc5546139f44b7 Mon Sep 17 00:00:00 2001 From: Clyne Sullivan Date: Tue, 21 Feb 2023 16:59:28 -0500 Subject: [PATCH] add recurse, move --- compat.txt | 4 ++-- core.fth | 13 ++++++++++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/compat.txt b/compat.txt index bfdbb5e..b225c16 100644 --- a/compat.txt +++ b/compat.txt @@ -96,7 +96,7 @@ yes 6.1.1805 LSHIFT yes 6.1.1870 MAX yes 6.1.1880 MIN yes 6.1.1890 MOD - 6.1.1900 MOVE +yes 6.1.1900 MOVE yes 6.1.1910 NEGATE yes 6.1.1980 OR yes 6.1.1990 OVER @@ -104,7 +104,7 @@ yes 6.1.2033 POSTPONE yes 6.1.2050 QUIT yes 6.1.2060 R> yes 6.1.2070 R@ - 6.1.2120 RECURSE +yes 6.1.2120 RECURSE yes 6.1.2140 REPEAT yes 6.1.2160 ROT yes 6.1.2162 RSHIFT diff --git a/core.fth b/core.fth index e461964..d156231 100644 --- a/core.fth +++ b/core.fth @@ -116,9 +116,9 @@ : create align here bl word count nip cell+ allot align ['] _lit , here 3 cells + , ['] exit , 0 , dup @ 31 & over _latest @ - 6 << or over ! _latest ! ; -: does> _latest @ - dup @ 31 & + cell+ aligned - 2 cells + +: _latword _latest @ + dup @ 31 & + cell+ aligned ; +: does> _latword 2 cells + ['] _jmp over ! cell+ here swap ! ] ; : >body cell+ @ ; @@ -132,3 +132,10 @@ : quit begin _rdepth 1 > while r> drop repeat postpone [ ; : abort begin depth 0 > while drop repeat quit ; + +: recurse _latword , ; imm + +: move begin dup 0 > while + rot dup @ >r cell+ + rot r> over ! cell+ + rot 1- repeat drop 2drop ;