From cef6074851aaa3abf3bb24f189760c1e792111d3 Mon Sep 17 00:00:00 2001 From: Brad Nelson Date: Wed, 13 Jul 2022 16:33:51 -0700 Subject: [PATCH] Make extras more consistent. --- common/extra2.fs | 2 ++ common/extra3.fs | 14 ++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/common/extra2.fs b/common/extra2.fs index 033cc60..288dabe 100644 --- a/common/extra2.fs +++ b/common/extra2.fs @@ -12,6 +12,8 @@ \ See the License for the specific language governing permissions and \ limitations under the License. +( Define more words that are usually in extra_opcodes.h ) + ( Fill, Move ) : cmove ( a a n -- ) for aft >r dup c@ r@ c! 1+ r> 1+ then next 2drop ; : cmove> ( a a n -- ) for aft 2dup swap r@ + c@ swap r@ + c! then next 2drop ; diff --git a/common/extra3.fs b/common/extra3.fs index 540f5c7..b76f341 100644 --- a/common/extra3.fs +++ b/common/extra3.fs @@ -12,6 +12,20 @@ \ See the License for the specific language governing permissions and \ limitations under the License. +( Add more words that are usually in extra_opcodes.h ) + : fsqrt ( r -- r ) 1e 20 0 do fover fover f/ f+ 0.5e f* loop fnip ; 3.14159265359e fconstant pi + +: fill32 ( a n v ) swap >r swap r> 0 ?do 2dup ! cell+ loop 2drop ; + +( Transfer internals that are extra opcodes ) +internals definitions +transfer{ + 'heap 'context 'latestxt 'notfound + 'heap-start 'heap-size 'stack-cells + 'boot 'boot-size 'tib + 'argc 'argv 'runner fill32 +}transfer +forth definitions