aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClyne Sullivan <clyne@bitgloo.com>2023-02-21 16:59:28 -0500
committerClyne Sullivan <clyne@bitgloo.com>2023-02-21 16:59:28 -0500
commit572a79b4c724d4c6c7770874bafc5546139f44b7 (patch)
treea3e800c1c0d49de8b18b5ffb8f0a7010b36dd8e2
parent9a5b8581d0fb18d20ac21b8d1f96bf18806f1742 (diff)
add recurse, move
-rw-r--r--compat.txt4
-rw-r--r--core.fth13
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 ;